diff options
author | Mehrdad Afshari <mehrdad@dropbox.com> | 2018-11-28 00:49:36 -0800 |
---|---|---|
committer | Mehrdad Afshari <mehrdad@dropbox.com> | 2018-11-28 00:53:46 -0800 |
commit | 8199aff7a66460fbc4e9a82ade2e95ef076fd8f9 (patch) | |
tree | 5cf53dc0ec62abee55b8d08e6fa049b3f9bfde51 | |
parent | c5d22df984d1f8f097ff3064338befedbb36a2c4 (diff) |
Fix Python blocking interceptors facing RpcError
RpcError should be returned from the continuation intact,
not raised.
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_interceptor.py | 8 |
2 files changed, 5 insertions, 4 deletions
@@ -1,2 +1,3 @@ +Dropbox, Inc. Google Inc. WeWork Companies Inc. diff --git a/src/python/grpcio/grpc/_interceptor.py b/src/python/grpcio/grpc/_interceptor.py index 4345114026..2a8ddd8ce4 100644 --- a/src/python/grpcio/grpc/_interceptor.py +++ b/src/python/grpcio/grpc/_interceptor.py @@ -232,8 +232,8 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable): credentials=new_credentials, wait_for_ready=new_wait_for_ready) return _UnaryOutcome(response, call) - except grpc.RpcError: - raise + except grpc.RpcError as rpc_error: + return rpc_error except Exception as exception: # pylint:disable=broad-except return _FailureOutcome(exception, sys.exc_info()[2]) @@ -354,8 +354,8 @@ class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable): credentials=new_credentials, wait_for_ready=new_wait_for_ready) return _UnaryOutcome(response, call) - except grpc.RpcError: - raise + except grpc.RpcError as rpc_error: + return rpc_error except Exception as exception: # pylint:disable=broad-except return _FailureOutcome(exception, sys.exc_info()[2]) |