-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 message field to the error message emitted by grpc-gateway #718
Conversation
…e it more consistent with Status
Codecov Report
@@ Coverage Diff @@
## master #718 +/- ##
=========================================
+ Coverage 56.28% 56.3% +0.01%
=========================================
Files 30 30
Lines 3061 3062 +1
=========================================
+ Hits 1723 1724 +1
Misses 1167 1167
Partials 171 171
Continue to review full report at Codecov.
|
runtime/errors.go
Outdated
@@ -66,6 +66,9 @@ var ( | |||
|
|||
type errorBody struct { | |||
Error string `protobuf:"bytes,1,name=error" json:"error"` | |||
// This is to make the error more compatible with users that expect errors to be Status objects. It should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a link to https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
this is really ugly. how to fix "error" and "message" repeat problem ? {
"error": "something error",
"code": 3
} after: {
"error": "something error",
"message": "something error",
"code": 3
} should web restore the code? |
you can just use to fix it before:
|
I agree, but unfortunately we have to keep the old |
@johanbrandhorst web should not remove the "error" field in http response json, the "error" field is defined for compatible for some rfc documents, more: |
I apologize, but you have confused me a bit. Your PR suggested that we should remove the |
This change if really affect our current restful document for open apis 😢 |
…ecosystem#718) * Add message field to the error message emitted by grpc-gateway to make it more consistent with Status
This is to make it more consistent with the Status proto message in order to make the error more consistent between grpc and json.
We currently use grpc-gateway for local developement and ESP in production and having to deal with the message in two different fields is a bit annoying. This makes the behaviour of grpc-gateway a bit more consistent with ESP.