aboutsummaryrefslogtreecommitdiff
path: root/models/errors/login_source.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-04-12 09:55:58 -0400
committerUnknwon <u@gogs.io>2018-04-12 09:55:58 -0400
commitf2ecfdc96a338815ffb2be898b3114031f0da48c (patch)
tree68e98cdb346e8d57e7d1b25169b391dd7afc0037 /models/errors/login_source.go
parent717d409b7273f7874c38268e1b908596277dacac (diff)
auth: support authentication source config file (#3142)
Diffstat (limited to 'models/errors/login_source.go')
-rw-r--r--models/errors/login_source.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/models/errors/login_source.go b/models/errors/login_source.go
index db0cd1f9..dd18664e 100644
--- a/models/errors/login_source.go
+++ b/models/errors/login_source.go
@@ -6,6 +6,19 @@ package errors
import "fmt"
+type LoginSourceNotExist struct {
+ ID int64
+}
+
+func IsLoginSourceNotExist(err error) bool {
+ _, ok := err.(LoginSourceNotExist)
+ return ok
+}
+
+func (err LoginSourceNotExist) Error() string {
+ return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
+}
+
type LoginSourceNotActivated struct {
SourceID int64
}
@@ -31,3 +44,17 @@ func IsInvalidLoginSourceType(err error) bool {
func (err InvalidLoginSourceType) Error() string {
return fmt.Sprintf("invalid login source type [type: %v]", err.Type)
}
+
+type LoginSourceMismatch struct {
+ Expect int64
+ Actual int64
+}
+
+func IsLoginSourceMismatch(err error) bool {
+ _, ok := err.(LoginSourceMismatch)
+ return ok
+}
+
+func (err LoginSourceMismatch) Error() string {
+ return fmt.Sprintf("login source mismatch [expect: %d, actual: %d]", err.Expect, err.Actual)
+}