Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional unwrap code in ToStatusError() gRPC error handler #434

Merged
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: 3 additions & 3 deletions server/grpchelper/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func detailsFromError(err error) (protoiface.MessageV1, bool) {
// occurs while executing logic in API handler, gRPC status.error should be
// returned so that the client can know more about the status of the request.
func ToStatusError(err error) error {
cause := errors.Unwrap(err)
if cause == nil {
cause = err
cause := err
for errors.Unwrap(cause) != nil {
cause = errors.Unwrap(cause)
}
if code, ok := errorToCode[cause]; ok {
return status.Error(code, err.Error())
Expand Down