From 9a2506c74ff647e4c66dd14b1a84a41ba9c3f09e Mon Sep 17 00:00:00 2001 From: Michael Birtwell Date: Wed, 6 Jul 2022 16:50:25 +0100 Subject: [PATCH] Improve error msg for RPC return failure Signed-off-by: Michael Birtwell --- artiq/coredevice/comm_kernel.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/artiq/coredevice/comm_kernel.py b/artiq/coredevice/comm_kernel.py index 930430b5e..584b31fa9 100644 --- a/artiq/coredevice/comm_kernel.py +++ b/artiq/coredevice/comm_kernel.py @@ -628,11 +628,17 @@ class CommKernel: else: logger.debug("rpc service: %d %r %r = %r", service_id, args, kwargs, result) - self._write_header(Request.RPCReply) - self._write_bytes(return_tags) - self._send_rpc_value(bytearray(return_tags), - result, result, service) - self._flush() + try: + self._write_header(Request.RPCReply) + self._write_bytes(return_tags) + self._send_rpc_value(bytearray(return_tags), + result, result, service) + 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): exception_count = self._read_int32()