Thank you! Looking at the code for _InactiveRpcError <https://github.com/grpc/grpc/blob/875066b61e3b57af4bb1d6e36aabe95a4f6ba4f7/src/python/grpcio/grpc/_channel.py#L318> it does indeed inherit from RpcError <https://github.com/grpc/grpc/blob/875066b61e3b57af4bb1d6e36aabe95a4f6ba4f7/src/python/grpcio/grpc/__init__.py#L301>. Unfortunately though, that base class doesn’t give any hint regarding the actual failure which, I suspect, is why subclasses and their status codes exist. Declaring code() <https://github.com/grpc/grpc/blob/875066b61e3b57af4bb1d6e36aabe95a4f6ba4f7/src/python/grpcio/grpc/_channel.py#L343-L344> (and other useful helpers) as an abstract method on RpcError would be helpful 🤔
On Wednesday, December 28, 2022 at 7:17:55 PM UTC+1 sanjay...@google.com wrote: > Check this out > https://grpc.github.io/grpc/python/grpc.html#grpc-exceptions > > "Raised by the gRPC library to indicate non-OK-status RPC termination." > (although it doesn't reference InactiveRpcError there for which I don't > have an answer) > > Exception is the only way to indicate an error in the RPC since returning > error via the return value is not possible. > > > > > On Wednesday, December 28, 2022 at 6:08:55 AM UTC-8 jens.t...@gmail.com > wrote: > >> Hello, suppose I create a request >> >> request = SomeRequest(name="Name", data=data) >> >> and send that off to the gRPC server: >> >> response = some_stub.DoStuff(request) >> >> then all works fine for grpc.Status.OK >> <https://grpc.github.io/grpc/core/md_doc_statuscodes.html>. However, it >> seems that any error response status causes an exception on the calling >> client, e.g. >> >> E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that >> terminated with: >> E status = StatusCode.INVALID_ARGUMENT >> E details = "..." >> E debug_error_string = "..." >> E > >> >> Is that exception intended, i.e. does *any* error response *always* >> result in an exception here? >> >> I’m also a little befuddled by the “inactive” and I wonder if I’m missing >> something, or if this just odd naming? >> >> Much thanks! >> Jens >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/84889b3a-945a-4163-b08c-2218e2a7f069n%40googlegroups.com.