From 9e9ca66467116e9079a2639c00e9e623aca23015 Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Mon, 16 Mar 2020 01:22:27 +0800 Subject: refactor: unify error handling in routing layer --- internal/db/errors/user.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'internal/db/errors/user.go') 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 } -- cgit v1.2.3