diff options
author | Unknwon <u@gogs.io> | 2017-03-16 17:18:43 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-16 17:18:43 -0400 |
commit | 0ccd7c97abcb1ae314c9c17b0c08863cb13115fa (patch) | |
tree | d5314ef88257d64b3749194c024ca853486f799e /models/errors/user.go | |
parent | 4e64e71e28dcfb9ef41d7cbc63ff1474ad8e5126 (diff) |
models: rename ErrUserNotExist -> errors.UserNotExist
Diffstat (limited to 'models/errors/user.go')
-rw-r--r-- | models/errors/user.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/errors/user.go b/models/errors/user.go index cda49e0e..526d4b2d 100644 --- a/models/errors/user.go +++ b/models/errors/user.go @@ -17,6 +17,20 @@ func (err EmptyName) Error() string { return "empty name" } +type UserNotExist struct { + UserID int64 + Name string +} + +func IsUserNotExist(err error) bool { + _, ok := err.(UserNotExist) + return ok +} + +func (err UserNotExist) Error() string { + return fmt.Sprintf("user does not exist [user_id: %d, name: %s]", err.UserID, err.Name) +} + type UserNotKeyOwner struct { KeyID int64 } |