aboutsummaryrefslogtreecommitdiff
path: root/models/errors/repo.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-03-08 07:15:55 -0500
committerUnknwon <u@gogs.io>2018-03-08 07:15:55 -0500
commit1f7983059aa80307a86c19088decaedfeb019755 (patch)
treef47209b37efbd5cbb585e2ea66f24fa5af14a06a /models/errors/repo.go
parent51e087fd8731137c969f616bc90f383a2c2bff27 (diff)
models: move ErrBranchNotExist to errors package
Diffstat (limited to 'models/errors/repo.go')
-rw-r--r--models/errors/repo.go13
1 files changed, 13 insertions, 0 deletions
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)
+}