fullstorydev / fullstorydev/grpcurl
Google error details are not printed correctly
- Dominant language
- Go
- Stars
- 12.8k
- Forks
- 580
- Avg merge
- 1h 8m
- Merged PRs (30d)
- 5
Description
The [status.proto](https://github.com/googleapis/googleapis/blob/master/google/rpc/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](https://github.com/googleapis/googleapis/blob/master/google/rpc/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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the shown grpcurl command and inspect the path that formats Status.details. Check how reflection is used by `describe google.rpc.LocalizedMessage`; done means standard and custom `google.protobuf.Any` error details are decoded when their message descriptors are available, instead of being shown as raw binary data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100