aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-08-12 16:12:14 +0200
committerMichael Muré <batolettre@gmail.com>2019-08-12 16:12:14 +0200
commit99b5c58d43137bd9f6503788a55484327b0c531f (patch)
tree08ecc0f923b5f1fb4e8a7627aeabccb335d92ad1 /bug/bug.go
parent67a3752e176790e82a48706236f889cab4f8913d (diff)
downloadgit-bug-99b5c58d43137bd9f6503788a55484327b0c531f.tar.gz
finish the refactoring for the dedicated identifier type
Diffstat (limited to 'bug/bug.go')
-rw-r--r--bug/bug.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/bug/bug.go b/bug/bug.go
index d22a2f5e..eb0337a4 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -29,18 +29,12 @@ const editClockEntryPattern = "edit-clock-%d"
var ErrBugNotExist = errors.New("bug doesn't exist")
-type ErrMultipleMatch struct {
- Matching []entity.Id
+func NewErrMultipleMatchBug(matching []entity.Id) *entity.ErrMultipleMatch {
+ return entity.NewErrMultipleMatch("bug", 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 bug found:\n%s", strings.Join(matching, "\n"))
+func NewErrMultipleMatchOp(matching []entity.Id) *entity.ErrMultipleMatch {
+ return entity.NewErrMultipleMatch("operation", matching)
}
var _ Interface = &Bug{}
@@ -100,7 +94,7 @@ func FindLocalBug(repo repository.ClockedRepo, prefix string) (*Bug, error) {
}
if len(matching) > 1 {
- return nil, ErrMultipleMatch{Matching: matching}
+ return nil, NewErrMultipleMatchBug(matching)
}
return ReadLocalBug(repo, matching[0])