Skip to content

Commit

Permalink
Use original error's message for gRPC error
Browse files Browse the repository at this point in the history
Signed-off-by: Jonny Stoten <jonny.stoten@docker.com>
  • Loading branch information
jonnystoten committed Jul 26, 2022
1 parent f4e20ec commit df0c9b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions util/grpcerrors/grpcerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func ToGRPC(err error) error {
st = status.FromProto(pb)
}

// If the original error was wrapped with more context than the GRPCStatus error,
// copy the original message to the GRPCStatus error
if err.Error() != st.Message() {
pb := st.Proto()
pb.Message = err.Error()
st = status.FromProto(pb)
}

var details []proto.Message

for _, st := range stack.Traces(err) {
Expand Down

0 comments on commit df0c9b6

Please sign in to comment.