Skip to content

Commit

Permalink
fix: err message
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jun 29, 2024
1 parent ed9940c commit bc1a9a3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apperror/apperror.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ func HandleServiceError(err error) *AppError {
if !ok {
return InternalServer
}

switch st.Code() {
case codes.InvalidArgument:
return BadRequestError(err.Error())
return BadRequestError(st.Message())
case codes.Unauthenticated:
return UnauthorizedError(err.Error())
return UnauthorizedError(st.Message())
case codes.PermissionDenied:
return ForbiddenError(err.Error())
return ForbiddenError(st.Message())
case codes.NotFound:
return NotFoundError(err.Error())
return NotFoundError(st.Message())
case codes.Internal:
return InternalServerError(err.Error())
return InternalServerError(st.Message())
default:
return ServiceUnavailable
}
Expand Down

0 comments on commit bc1a9a3

Please sign in to comment.