aboutsummaryrefslogtreecommitdiff
path: root/models/error.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-31 01:22:41 -0700
committerUnknwon <u@gogs.io>2016-08-31 01:22:41 -0700
commit152e715999bfec9859423034aec3df90442961f1 (patch)
tree8454c6460e7f54b8f84b0e7b83864224a94df15a /models/error.go
parent99c2ae7b355556776f0a2231a3173a0c554e9ffe (diff)
models/login_source: code improvement
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 065857e0..182a944a 100644
--- a/models/error.go
+++ b/models/error.go
@@ -635,6 +635,19 @@ func (err ErrLoginSourceAlreadyExist) Error() string {
return fmt.Sprintf("login source already exists [name: %s]", err.Name)
}
+type ErrLoginSourceInUse struct {
+ ID int64
+}
+
+func IsErrLoginSourceInUse(err error) bool {
+ _, ok := err.(ErrLoginSourceInUse)
+ return ok
+}
+
+func (err ErrLoginSourceInUse) Error() string {
+ return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
+}
+
// ___________
// \__ ___/___ _____ _____
// | |_/ __ \\__ \ / \