Skip to content

Commit

Permalink
chore: improve grpc error
Browse files Browse the repository at this point in the history
  • Loading branch information
qloog committed Oct 20, 2024
1 parent 39935b6 commit 9307c19
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/errcode/grpc_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ func ToRPCCode(code int) codes.Code {
var statusCode codes.Code

switch code {
case ErrInternalServer.code:
case ErrInternalServer.Code():
statusCode = codes.Internal
case ErrInvalidParam.code:
case ErrInvalidParam.Code():
statusCode = codes.InvalidArgument
case ErrUnauthorized.code:
case ErrUnauthorized.Code():
statusCode = codes.Unauthenticated
case ErrNotFound.code:
case ErrNotFound.Code():
statusCode = codes.NotFound
case ErrDeadlineExceeded.code:
case ErrDeadlineExceeded.Code():
statusCode = codes.DeadlineExceeded
case ErrAccessDenied.code:
case ErrAccessDenied.Code():
statusCode = codes.PermissionDenied
case ErrLimitExceed.code:
case ErrLimitExceed.Code():
statusCode = codes.ResourceExhausted
case ErrMethodNotAllowed.code:
case ErrMethodNotAllowed.Code():
statusCode = codes.Unimplemented
default:
statusCode = codes.Unknown
Expand Down

0 comments on commit 9307c19

Please sign in to comment.