diff options
author | Michael Muré <batolettre@gmail.com> | 2019-08-12 16:12:14 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-08-12 16:12:14 +0200 |
commit | 99b5c58d43137bd9f6503788a55484327b0c531f (patch) | |
tree | 08ecc0f923b5f1fb4e8a7627aeabccb335d92ad1 /bug/bug.go | |
parent | 67a3752e176790e82a48706236f889cab4f8913d (diff) | |
download | git-bug-99b5c58d43137bd9f6503788a55484327b0c531f.tar.gz |
finish the refactoring for the dedicated identifier type
Diffstat (limited to 'bug/bug.go')
-rw-r--r-- | bug/bug.go | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -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]) |