From 1f7983059aa80307a86c19088decaedfeb019755 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 8 Mar 2018 07:15:55 -0500 Subject: models: move ErrBranchNotExist to errors package --- models/errors/repo.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'models/errors/repo.go') diff --git a/models/errors/repo.go b/models/errors/repo.go index 69c29be6..c9894af9 100644 --- a/models/errors/repo.go +++ b/models/errors/repo.go @@ -72,3 +72,16 @@ func IsBranchAlreadyExists(err error) bool { func (err BranchAlreadyExists) Error() string { return fmt.Sprintf("branch already exists [name: %s]", err.Name) } + +type ErrBranchNotExist struct { + Name string +} + +func IsErrBranchNotExist(err error) bool { + _, ok := err.(ErrBranchNotExist) + return ok +} + +func (err ErrBranchNotExist) Error() string { + return fmt.Sprintf("branch does not exist [name: %s]", err.Name) +} -- cgit v1.2.3