From 60d15bbe2a638fe85ccc73f89ef73f65dae567e9 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Fri, 19 Apr 2024 14:45:53 -0500 Subject: [PATCH] exit on communication failure --- .../deephaven/ui/object_types/ElementMessageStream.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py b/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py index 5d4d1c593..474b16ad1 100644 --- a/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py +++ b/plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py @@ -2,6 +2,8 @@ import io import json +import sys + from jsonrpc import JSONRPCResponseManager, Dispatcher import logging import threading @@ -352,4 +354,11 @@ def _send_document_update( logger.debug("Registering callable %s", callable_id) dispatcher[callable_id] = wrap_callable(callable) self._dispatcher = dispatcher - self._connection.on_data(payload.encode(), new_objects) + try: + self._connection.on_data(payload.encode(), new_objects) + except RuntimeError as e: + if "io.deephaven.plugin.type.ObjectCommunicationException" in str(e): + # can no longer send, don't need to raise exception but do need to exit + sys.exit() + else: + raise e