diff options
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index 04f850def9..067eace239 100644 --- a/models/error.go +++ b/models/error.go @@ -54,6 +54,20 @@ func (err ErrUserAlreadyExist) Error() string { return fmt.Sprintf("user already exists: [name: %s]", err.Name) } +type ErrUserNotExist struct { + UID int64 + Name string +} + +func IsErrUserNotExist(err error) bool { + _, ok := err.(ErrUserNotExist) + return ok +} + +func (err ErrUserNotExist) Error() string { + return fmt.Sprintf("user does not exist: [uid: %d, name: %s]", err.UID, err.Name) +} + type ErrEmailAlreadyUsed struct { Email string } |