summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
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 065857e001..182a944a6f 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)
+}
+
// ___________
// \__ ___/___ _____ _____
// | |_/ __ \\__ \ / \