Improve error msg for RPC return failure

Signed-off-by: Michael Birtwell <michael.birtwell@oxionics.com>
This commit is contained in:
Michael Birtwell 2022-07-06 16:50:25 +01:00
parent a028b5c9f7
commit 9a2506c74f
1 changed files with 11 additions and 5 deletions

View File

@ -628,11 +628,17 @@ class CommKernel:
else: else:
logger.debug("rpc service: %d %r %r = %r", logger.debug("rpc service: %d %r %r = %r",
service_id, args, kwargs, result) service_id, args, kwargs, result)
try:
self._write_header(Request.RPCReply) self._write_header(Request.RPCReply)
self._write_bytes(return_tags) self._write_bytes(return_tags)
self._send_rpc_value(bytearray(return_tags), self._send_rpc_value(bytearray(return_tags),
result, result, service) result, result, service)
self._flush() self._flush()
except Exception as ex:
raise RuntimeError(
f"Failed to return RPC value for RPC [{service_id}]{service!r} "
f"return_tags={return_tags}: {ex}"
) from ex
def _serve_exception(self, embedding_map, symbolizer, demangler): def _serve_exception(self, embedding_map, symbolizer, demangler):
exception_count = self._read_int32() exception_count = self._read_int32()