Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to extract extended gRPC details from Python exception? #22

Open
rdmoore opened this issue Oct 11, 2021 · 1 comment
Open

Comments

@rdmoore
Copy link

rdmoore commented Oct 11, 2021

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. Example client code block:

    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:

		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()
@avinassh
Copy link
Owner

Hey! So I am actually working on adding details part of errors, it is work in progress. However you are in luck, since I have added python code samples - #15

Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants