Skip to content

Commit 25b0c0d

Browse files
fix(nodes): improve error handling in remote node execution (#565)
* feat(vscode): improve stop button feedback in Pipeline Observability screen Handle TASK_STATE.STOPPING in the control button to show "Stopping..." with a disabled state and distinct orange styling, preventing duplicate clicks and giving immediate visual feedback during pipeline shutdown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(nodes): improve error handling in remote node execution Replace fragile string-based error origin detection with proper type checking (isinstance + error code comparison). Always send error signals to the remote side to prevent hanging connections. Narrow exception catch from BaseException to Exception to avoid intercepting KeyboardInterrupt and SystemExit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9995ff0 commit 25b0c0d

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

nodes/src/nodes/remote/base/IInstance.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,15 @@ def callRemote(self, lane: str, data: None | str | bytes | dict | list = None):
190190
# Send the success signal to the remote pipeline
191191
self._send('error', APERR().toDict())
192192

193-
except BaseException as e:
194-
# TODO: Improve local/remote error handling
195-
if (msg := str(e)) and 'RemoteException:' not in msg:
196-
# Send the error signal to the remote pipeline
197-
self._send('error', APERR(Ec.RemoteException, msg).toDict())
193+
except Exception as e:
194+
# Determine whether this error originated from the remote side.
195+
# If so, propagate the original error code; otherwise wrap it as
196+
# a new RemoteException so the remote side sees what went wrong.
197+
if isinstance(e, APERR) and e.ec == Ec.RemoteException:
198+
self._send('error', e.toDict())
199+
else:
200+
self._send('error', APERR(Ec.RemoteException, str(e)).toDict())
198201

199-
# Re-raise the exception
200202
raise
201203

202204
def callLocal(self, lane: str, data):

nodes/src/nodes/remote/server/IInstance.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ def handleWebSocket(self, webSocket: WebSocket):
5959
# Send the success signal to the remote pipeline
6060
self._send('error', APERR().toDict())
6161

62-
except BaseException as e:
63-
# TODO: Improve local/remote error handling
64-
if (msg := str(e)) and 'RemoteException:' not in msg:
65-
# Send the error signal to the remote pipeline
66-
self._send('error', APERR(Ec.RemoteException, msg).toDict())
62+
except Exception as e:
63+
# Determine whether this error originated from the remote side.
64+
# If so, propagate the original error code; otherwise wrap it as
65+
# a new RemoteException so the remote side sees what went wrong.
66+
if isinstance(e, APERR) and e.ec == Ec.RemoteException:
67+
self._send('error', e.toDict())
68+
else:
69+
self._send('error', APERR(Ec.RemoteException, str(e)).toDict())
6770

68-
# Re-raise the exception
6971
raise
7072

7173
def writeText(self, text: str):

0 commit comments

Comments
 (0)