summaryrefslogtreecommitdiffstatshomepage
path: root/entity/err.go
diff options
context:
space:
mode:
Diffstat (limited to 'entity/err.go')
-rw-r--r--entity/err.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/entity/err.go b/entity/err.go
index 408e27b4..9d7c266e 100644
--- a/entity/err.go
+++ b/entity/err.go
@@ -5,6 +5,23 @@ import (
"strings"
)
+type ErrNotFound struct {
+ typename string
+}
+
+func NewErrNotFound(typename string) *ErrNotFound {
+ return &ErrNotFound{typename: typename}
+}
+
+func (e ErrNotFound) Error() string {
+ return fmt.Sprintf("%s doesn't exist", e.typename)
+}
+
+func IsErrNotFound(err error) bool {
+ _, ok := err.(*ErrNotFound)
+ return ok
+}
+
type ErrMultipleMatch struct {
entityType string
Matching []Id