Google docs propose the following model (https://cloud.google.com/apis/design/errors#error_model) for sending rich errors in gRPC but it seems that the error string is sent to the user every time. What I want to do is to send a code and then map it to a string when it reaches the client.
What I want to know is whatever the proto3
language supports writing data so that I would use it client-side, without defining a custom structure for the purposes of mapping error codes to error messages.
In your
proto
definition, define a simpleenum
with any extra error codes:And include it as a top-level field in any returned
message
:if a message is sent with a non-zero
extraStatusCode
- then an edge case was encountered.