aboutsummaryrefslogtreecommitdiffstats
path: root/entity/err.go
diff options
context:
space:
mode:
Diffstat (limited to 'entity/err.go')
-rw-r--r--entity/err.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/entity/err.go b/entity/err.go
index 9356433d..7022305c 100644
--- a/entity/err.go
+++ b/entity/err.go
@@ -1 +1,27 @@
package entity
+
+import (
+ "fmt"
+ "strings"
+)
+
+type ErrMultipleMatch struct {
+ entityType string
+ Matching []Id
+}
+
+func NewErrMultipleMatch(entityType string, matching []Id) *ErrMultipleMatch {
+ return &ErrMultipleMatch{entityType: entityType, Matching: matching}
+}
+
+func (e ErrMultipleMatch) Error() string {
+ matching := make([]string, len(e.Matching))
+
+ for i, match := range e.Matching {
+ matching[i] = match.String()
+ }
+
+ return fmt.Sprintf("Multiple matching %s found:\n%s",
+ e.entityType,
+ strings.Join(matching, "\n"))
+}