We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you throw an error in stream gRPC API
return status.Error(codes.NotFound, "Foo Bar");
the grpc-gateway translate it this way:
{"error":{"grpc_code":5,"http_code":404,"message":"rpc error: code = NotFound desc = Foo Bar","http_status":"Not Found"}}
Expected result:
{"error":{"grpc_code":5,"http_code":404,"message":"Foo Bar","http_status":"Not Found"}}
Here's a code that might fix it in runtime/handler.go
runtime/handler.go
func streamChunk(result proto.Message, err error) map[string]proto.Message { if err != nil { grpcCode := codes.Unknown message := err.Error() if s, ok := status.FromError(err); ok { grpcCode = s.Code() message = s.Message() } httpCode := HTTPStatusFromCode(grpcCode) return map[string]proto.Message{ "error": &internal.StreamError{ GrpcCode: int32(grpcCode), HttpCode: int32(httpCode), Message: message, HttpStatus: http.StatusText(httpCode), }, } } ...
The text was updated successfully, but these errors were encountered:
I think this is going to be handled by #515. Please reopen if you don't htink that's the case.
Sorry, something went wrong.
@achew22 Thank you for quick reply. I'm not sure it is the same issue. I will double check.
No branches or pull requests
If you throw an error in stream gRPC API
the grpc-gateway translate it this way:
Expected result:
Here's a code that might fix it in
runtime/handler.go
The text was updated successfully, but these errors were encountered: