grpc-gateway: customize the error return
If the input type is error, gateway will return a json.
I need to customize the message. Is there a way ?
➜ ~ git:(master) ✗ curl 'localhost:9998/v1/example/echo?name=dddd'
{"error":"strconv.ParseInt: parsing \"dddd\": invalid syntax","code":3}%
the name is int32
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 21 (2 by maintainers)
Commits related to this issue
- runtime/errors: handle error details Fixes #405. If we go with this, that is. In a separate commit, I'll update the generated files. Signed-off-by: Stephan Renatus <srenatus@chef.io> — committed to srenatus/grpc-gateway by srenatus 6 years ago
- runtime/errors: handle error details Fixes #405. If we go with this, that is. In a separate commit, I'll update the generated files. Signed-off-by: Stephan Renatus <srenatus@chef.io> — committed to srenatus/grpc-gateway by srenatus 6 years ago
- runtime/errors: handle error details Fixes #405. If we go with this, that is. In a separate commit, I'll update the generated files. Signed-off-by: Stephan Renatus <srenatus@chef.io> — committed to srenatus/grpc-gateway by srenatus 6 years ago
- runtime/errors: handle error details Fixes #405. If we go with this, that is. In a separate commit, I'll update the generated files. Signed-off-by: Stephan Renatus <srenatus@chef.io> — committed to srenatus/grpc-gateway by srenatus 6 years ago
I think this can be closed now that https://github.com/grpc-ecosystem/grpc-gateway/pull/515 has been merged.
Hi, I created a PR #409 , it’s almost the same with #397 .
For we are blocked by this issue, if there is anything I can help with, please let me know.
Thank you!
Have a look at this PR: https://github.com/grpc-ecosystem/grpc-gateway/pull/397
Is there a specific reason why you would want to customize the message? Will a HTTP 400 suffice?
Do we have a workaround for this? I think that the issue OP addressed hasn’t been resolved. I would like to hide the implementation details from the user. For example, a message like this exposes unnecessary information:
I do not know #51 whether solve this problem. Let the project member to close this issue.