diff options
Diffstat (limited to 'models/errors')
-rw-r--r-- | models/errors/repo.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/errors/repo.go b/models/errors/repo.go index 15adb2b0..69c29be6 100644 --- a/models/errors/repo.go +++ b/models/errors/repo.go @@ -59,3 +59,16 @@ func IsMirrorNotExist(err error) bool { func (err MirrorNotExist) Error() string { return fmt.Sprintf("mirror does not exist [repo_id: %d]", err.RepoID) } + +type BranchAlreadyExists struct { + Name string +} + +func IsBranchAlreadyExists(err error) bool { + _, ok := err.(BranchAlreadyExists) + return ok +} + +func (err BranchAlreadyExists) Error() string { + return fmt.Sprintf("branch already exists [name: %s]", err.Name) +} |