Skip to content

Commit

Permalink
Add additional unwrap code in ToStatusError gRPC error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
krapie committed Dec 29, 2022
1 parent a558c0f commit d65f949
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/grpchelper/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func ToStatusError(err error) error {
cause := errors.Unwrap(err)
if cause == nil {
cause = err
} else {
for errors.Unwrap(cause) != nil {
cause = errors.Unwrap(cause)
}
}
if code, ok := errorToCode[cause]; ok {
return status.Error(code, err.Error())
Expand Down

0 comments on commit d65f949

Please sign in to comment.