avinassh / avinassh/grpc-errors
Is it possible to extract extended gRPC details from Python exception?
- Dominant language
- C#
- Stars
- 588
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to extract the "details" portion of a gRPC error using Python as the client language. The core protobuf definition that I am basing the behavior on is documented [here](https://cloud.google.com/apis/design/errors#error_model). Example client code block:
```python
try:
response = client.Create(req, timeout=30)
print(response)
except grpc._channel._InactiveRpcError as e:
print("caught as inactive RPC error")
print(e.__class__)
print(e.details.__class__)
print(e.details)
```
I was expected the details to be the extended content rather than the error message. Am I overlooking something obvious? Is this not supported in the Python client library?
The server-side code is written in go and looks something like this:
```go
s := status.New(codes.AlreadyExists, "dataset already exists for combination of subject and provenance")
if s, err = s.WithDetails(res.VersionSets[0]); err != nil {
logrus.Panicf("cannot add details to google.rpc.Status: %+v", err)
}
return nil, s.Err()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.