grpcurl
grpcurl copied to clipboard
Google error details are not printed correctly
trafficstars
The status.proto contains a list of error details of type Any.
message Status {
int32 code = 1;
string message = 2;
repeated google.protobuf.Any details = 3;
}
If an request results in an exception and error details are provided, the error details are not printed correctly. At least the error details of error_details.proto should be supported.
❯ grpcurl -plaintext -d '{ "ctr": "666" }' localhost:9090 countryservice.CountryService.GetCountry
ERROR:
Code: Internal
Message: peng IllegalArgumentException
Details:
1) {"@error":"google.rpc.LocalizedMessage is not recognized; see @value for raw binary message data","@type":"type.googleapis.com/google.rpc.LocalizedMessage","@value":"EiRFaW4gaW50ZXJuZXIgRmVobGVyIGlzdCBhdWZnZXRyZXRlbi4="}
This does not work, even if the google.rpc.LocalizedMessage is available via reflection:
❯ grpcurl -plaintext localhost:9090 describe google.rpc.LocalizedMessage
google.rpc.LocalizedMessage is a message:
message LocalizedMessage {
string locale = 1;
string message = 2;
}
Either grpcurl should know the standard error details, or it should use reflection to look it up. The second approach would be better, as it also supports custom error details.