aboutsummaryrefslogtreecommitdiffstats
path: root/entity/err.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-11-19 11:33:12 +0100
committerMichael Muré <batolettre@gmail.com>2022-11-28 17:20:25 +0100
commit0ac39a7ab5db077fcf0df827e32bf6e625e980da (patch)
treee453d6fd244cb322bdc6305c0088aa3c0331b075 /entity/err.go
parentc6bb6b9c7ecddb679966b1561e2e909a9ee5e8cd (diff)
downloadgit-bug-0ac39a7ab5db077fcf0df827e32bf6e625e980da.tar.gz
WIP
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