summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index e52d9b16d9..0e554e5273 100644
--- a/models/error.go
+++ b/models/error.go
@@ -225,6 +225,20 @@ func (err ErrRepoNotExist) Error() string {
return fmt.Sprintf("repository does not exist [id: %d, uid: %d, name: %s]", err.ID, err.UID, err.Name)
}
+type ErrRepoAlreadyExist struct {
+ Uname string
+ Name string
+}
+
+func IsErrRepoAlreadyExist(err error) bool {
+ _, ok := err.(ErrRepoAlreadyExist)
+ return ok
+}
+
+func (err ErrRepoAlreadyExist) Error() string {
+ return fmt.Sprintf("repository already exists [uname: %d, name: %s]", err.Uname, err.Name)
+}
+
// _____ .__.__ __
// / \ |__| | ____ _______/ |_ ____ ____ ____
// / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \