diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-03-16 01:22:27 +0800 |
---|---|---|
committer | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-03-16 01:22:27 +0800 |
commit | 9e9ca66467116e9079a2639c00e9e623aca23015 (patch) | |
tree | dacdef5392608ff7107e4dd498959d4899e13e54 /internal/db/errors/user.go | |
parent | 82ff0c5852f29daa5f95d965fd50665581e7ea3c (diff) |
refactor: unify error handling in routing layer
Diffstat (limited to 'internal/db/errors/user.go')
-rw-r--r-- | internal/db/errors/user.go | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/internal/db/errors/user.go b/internal/db/errors/user.go index 526d4b2d..54a6ad50 100644 --- a/internal/db/errors/user.go +++ b/internal/db/errors/user.go @@ -4,7 +4,9 @@ package errors -import "fmt" +import ( + "fmt" +) type EmptyName struct{} @@ -17,20 +19,6 @@ 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 } |