Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5577f90f95 | ||
|
587cd1c9b4 |
@@ -2,7 +2,10 @@ package {{.PackageName}}
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"iter"
|
||||
|
||||
"github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -15,10 +18,10 @@ func translateError(err error) error {
|
||||
return nil
|
||||
}
|
||||
if e, ok := err.(sqlite3.Error); ok && e.Code == 19 {
|
||||
return ErrConstraint
|
||||
return errors.Join(ErrConstraint, err)
|
||||
}
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return ErrNotFound
|
||||
return errors.Join(ErrNotFound, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user