diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-11 15:03:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-11 15:03:30 +0800 |
commit | 90eb9fb889e5d3a5845576dbc63e3792f3da33f2 (patch) | |
tree | 4107df9dd446fe9a93e49cba1e59d0f721e70351 /models/error.go | |
parent | 492e1c2fbd1b646f4428207942a9f89b56f7b6a9 (diff) | |
download | gitea-90eb9fb889e5d3a5845576dbc63e3792f3da33f2.tar.gz gitea-90eb9fb889e5d3a5845576dbc63e3792f3da33f2.zip |
Move EmailAddress & UserRedirect into models/user/ (#17607)
* Move EmailAddress into models/user/
* Fix test
* rename user_mail to user_email
* Fix test
* Move UserRedirect into models/user/
* Fix lint & test
* Fix lint
* Fix lint
* remove nolint comment
* Fix lint
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/models/error.go b/models/error.go index b365a67b73..db0fce0ce1 100644 --- a/models/error.go +++ b/models/error.go @@ -123,21 +123,6 @@ func (err ErrUserNotExist) Error() string { return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID) } -// ErrUserRedirectNotExist represents a "UserRedirectNotExist" kind of error. -type ErrUserRedirectNotExist struct { - Name string -} - -// IsErrUserRedirectNotExist check if an error is an ErrUserRedirectNotExist. -func IsErrUserRedirectNotExist(err error) bool { - _, ok := err.(ErrUserRedirectNotExist) - return ok -} - -func (err ErrUserRedirectNotExist) Error() string { - return fmt.Sprintf("user redirect does not exist [name: %s]", err.Name) -} - // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error. type ErrUserProhibitLogin struct { UID int64 @@ -170,66 +155,6 @@ func (err ErrUserInactive) Error() string { return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name) } -// ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error. -type ErrEmailAlreadyUsed struct { - Email string -} - -// IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed. -func IsErrEmailAlreadyUsed(err error) bool { - _, ok := err.(ErrEmailAlreadyUsed) - return ok -} - -func (err ErrEmailAlreadyUsed) Error() string { - return fmt.Sprintf("e-mail already in use [email: %s]", err.Email) -} - -// ErrEmailInvalid represents an error where the email address does not comply with RFC 5322 -type ErrEmailInvalid struct { - Email string -} - -// IsErrEmailInvalid checks if an error is an ErrEmailInvalid -func IsErrEmailInvalid(err error) bool { - _, ok := err.(ErrEmailInvalid) - return ok -} - -func (err ErrEmailInvalid) Error() string { - return fmt.Sprintf("e-mail invalid [email: %s]", err.Email) -} - -// ErrEmailAddressNotExist email address not exist -type ErrEmailAddressNotExist struct { - Email string -} - -// IsErrEmailAddressNotExist checks if an error is an ErrEmailAddressNotExist -func IsErrEmailAddressNotExist(err error) bool { - _, ok := err.(ErrEmailAddressNotExist) - return ok -} - -func (err ErrEmailAddressNotExist) Error() string { - return fmt.Sprintf("Email address does not exist [email: %s]", err.Email) -} - -// ErrPrimaryEmailCannotDelete primary email address cannot be deleted -type ErrPrimaryEmailCannotDelete struct { - Email string -} - -// IsErrPrimaryEmailCannotDelete checks if an error is an ErrPrimaryEmailCannotDelete -func IsErrPrimaryEmailCannotDelete(err error) bool { - _, ok := err.(ErrPrimaryEmailCannotDelete) - return ok -} - -func (err ErrPrimaryEmailCannotDelete) Error() string { - return fmt.Sprintf("Primary email address cannot be deleted [email: %s]", err.Email) -} - // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error. type ErrOpenIDAlreadyUsed struct { OpenID string |