summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index 48cba57a81..501bf86869 100644
--- a/models/error.go
+++ b/models/error.go
@@ -237,6 +237,21 @@ 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