From 1df63bf35b3f7be36f2b8cbc07286fca32585777 Mon Sep 17 00:00:00 2001 From: Mariano Anaya Date: Thu, 6 Feb 2020 09:19:16 +0100 Subject: [PATCH] Get the debug_error_string in a simpler fashion * Use the public method in ``AioRpcStatus`` * Keep everything encapsulated inside the function that creates the error. --- src/python/grpcio/grpc/experimental/aio/_call.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/python/grpcio/grpc/experimental/aio/_call.py b/src/python/grpcio/grpc/experimental/aio/_call.py index fb7f486966c..1a43c44f5c5 100644 --- a/src/python/grpcio/grpc/experimental/aio/_call.py +++ b/src/python/grpcio/grpc/experimental/aio/_call.py @@ -142,14 +142,13 @@ class AioRpcError(grpc.RpcError): def _create_rpc_error(initial_metadata: Optional[MetadataType], - status: cygrpc.AioRpcStatus, - debug_error_string: Optional[str] = None) -> AioRpcError: + status: cygrpc.AioRpcStatus) -> AioRpcError: return AioRpcError( _common.CYGRPC_STATUS_CODE_TO_STATUS_CODE[status.code()], status.details(), initial_metadata, status.trailing_metadata(), - debug_error_string, + status.debug_error_string(), ) @@ -275,12 +274,8 @@ class _UnaryResponseMixin(Call): if self._cython_call.is_locally_cancelled(): raise asyncio.CancelledError() else: - call_status = self._cython_call._status - debug_error_string = None - if call_status is not None: - debug_error_string = call_status._debug_error_string raise _create_rpc_error(self._cython_call._initial_metadata, - call_status, debug_error_string) + self._cython_call._status) else: return response