Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions errors/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ const (

// if the argument is not valid
InvalidArgument ErrCode = 3

// Unauthorized request error
Unauthorized ErrCode = 4

// Forbidden action error
Forbidden ErrCode = 5
)
12 changes: 12 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,15 @@ func IsAlreadyExists(err error) bool {
func IsInvalidArgument(err error) bool {
return GetErrCode(err) == InvalidArgument
}

// IsUnauthorized returns true if err
// is due to Unauthorized request
func IsUnauthorized(err error) bool {
return GetErrCode(err) == Unauthorized
}

// IsForbidden returns true if err
// is due to Forbidden action
func IsForbidden(err error) bool {
return GetErrCode(err) == Forbidden
}