summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-10 12:37:53 -0500
committerUnknwon <u@gogs.io>2015-12-10 12:37:53 -0500
commit2a0bb1fa906a4d135ed88de4f705c3ab7214e60c (patch)
tree37d207458c999c5789fd6ca3a2c62d6700ed81b7 /models/error.go
parentc6083c335e53a860fd4c500a86dcdda49a16515e (diff)
downloadgitea-2a0bb1fa906a4d135ed88de4f705c3ab7214e60c.tar.gz
gitea-2a0bb1fa906a4d135ed88de4f705c3ab7214e60c.zip
#1575 Limit repo creation
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index 54d32d1546..83a24e7f4e 100644
--- a/models/error.go
+++ b/models/error.go
@@ -107,6 +107,19 @@ func (err ErrUserHasOrgs) Error() string {
return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
}
+type ErrReachLimitOfRepo struct {
+ Limit int
+}
+
+func IsErrReachLimitOfRepo(err error) bool {
+ _, ok := err.(ErrReachLimitOfRepo)
+ return ok
+}
+
+func (err ErrReachLimitOfRepo) Error() string {
+ return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
+}
+
// __ __.__ __ .__
// / \ / \__| | _|__|
// \ \/\/ / | |/ / |