Refactor: move error variables from host/static to db (#68)

The error variables defined in host/static are generic and can be reused
by other packages.
This commit is contained in:
Michael Gaffney authored and GitHub committed 2020-05-20 16:23:22 -04:00
1 parent ba00b511e7
commit c9ad86c7ba
1 file changed
+22
+22
View File
@@ -0,0 +1,22 @@
package db
import "errors"
// Errors returned from this package may be tested against these errors
// with errors.Is.
var (
// ErrInvalidPublicId indicates an invalid PublicId.
ErrInvalidPublicId = errors.New("invalid publicId")
// ErrInvalidParameter is returned by create and update methods if
// an attribute on a struct contains illegal or invalid values.
ErrInvalidParameter = errors.New("invalid parameter")
// ErrNotUnique is returned by create and update methods when a write
// to the repository resulted in a unique constraint violation.
ErrNotUnique = errors.New("unique constraint violation")
// ErrNilParameter is returned when a required parameter is nil.
ErrNilParameter = errors.New("nil parameter")
)