d5h-foss / grpc-interceptor

Simplified Python gRPC interceptors
MIT License
136 stars 21 forks source link

Support for google.rpc.Status #14

Closed jeffsawatzky closed 1 year ago

jeffsawatzky commented 2 years ago

We would like to return richer errors using google.rpc.Status with additional details. Would it be possible to add this to the exception service interceptor?

We could write our own, but I assume others would like this too and might be nice to have as base functionality.

I don't mind putting up a PR, but would like your feedback first before I waste my time. Thanks!

d5h commented 2 years ago

I’m not sure I understand what kind of extensions you’re suggesting. Can you give an example?

jeffsawatzky commented 2 years ago

Right now this only supports the basic string code and description error details. However I would like to use the richer error model here: https://grpc.io/docs/guides/error/#richer-error-model

Which lets you also return further error details from here: https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto

Here is a use case: https://stackoverflow.com/a/55149655/2233608

Here are more details: https://github.com/grpc/proposal/blob/master/L44-python-rich-status.md

jeffsawatzky commented 1 year ago

Closing this as we can accomplish this by overriding the handle_exception method as described in #12