diff options
author | 2017-12-14 16:01:25 -0800 | |
---|---|---|
committer | 2018-05-17 07:42:02 -0700 | |
commit | 0b8b9a08e28f57231075b8d9804daaf966f86ba8 (patch) | |
tree | 13c138447cd205910db51ccb3bf9c7250d3cc504 /src/python/grpcio_tests/tests/unit | |
parent | 6e5ca7bad72ebf50f9245e1e1f2eb642f285067a (diff) |
Surfaces debug_error_string to Python API
In case of error, the user can access call.debug_error_string()
which contains a string representation of error from the c core.
Diffstat (limited to 'src/python/grpcio_tests/tests/unit')
-rw-r--r-- | src/python/grpcio_tests/tests/unit/_rpc_test.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/python/grpcio_tests/tests/unit/_rpc_test.py b/src/python/grpcio_tests/tests/unit/_rpc_test.py index 54f01d9f8d..34e7831a98 100644 --- a/src/python/grpcio_tests/tests/unit/_rpc_test.py +++ b/src/python/grpcio_tests/tests/unit/_rpc_test.py @@ -225,6 +225,7 @@ class RPCTest(unittest.TestCase): self.assertEqual(expected_response, response) self.assertIs(grpc.StatusCode.OK, call.code()) + self.assertEqual("", call.debug_error_string()) def testSuccessfulUnaryRequestFutureUnaryResponse(self): request = b'\x07\x08' @@ -706,6 +707,13 @@ class RPCTest(unittest.TestCase): self.assertIs(grpc.StatusCode.UNKNOWN, exception_context.exception.code()) + # sanity checks on to make sure returned string contains default members + # of the error + debug_error_string = exception_context.exception.debug_error_string() + self.assertIn("created", debug_error_string) + self.assertIn("description", debug_error_string) + self.assertIn("file", debug_error_string) + self.assertIn("file_line", debug_error_string) def testFailedUnaryRequestFutureUnaryResponse(self): request = b'\x37\x17' |