Skip to content

Commit 4bace43

Browse files
author
Kevin Xiao
committed
Re-raise python exceptions in pythonboard for more information
1 parent 7ced9cc commit 4bace43

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

seeds/pythonboard/src/traversal/iterator.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,22 @@ def _processCompletedNode(
4545
if outputs.get("$error") and not any(e.out == "$error" for e in newOpportunities):
4646
# If the node threw an exception and it wasn't routed via $error,
4747
# throw it again. This will cause the traversal to stop.
48-
raise Exception(
49-
"Uncaught exception in node handler. " +
50-
"Catch by wiring up the $error output.",
51-
{
52-
"cause": outputs["$error"],
53-
}
54-
)
48+
if isinstance(outputs.get("$error").error, Exception):
49+
raise Exception(
50+
"Uncaught exception in node handler. " +
51+
"Catch by wiring up the $error output.",
52+
{
53+
"cause": outputs["$error"],
54+
}
55+
) from outputs.get("$error").error
56+
else:
57+
raise Exception(
58+
"Uncaught exception in node handler. " +
59+
"Catch by wiring up the $error output.",
60+
{
61+
"cause": outputs["$error"],
62+
}
63+
)
5564

5665
@staticmethod
5766
async def processAllPendingNodes(
@@ -89,7 +98,8 @@ async def _promise():
8998
# If not already present, add inputs and descriptor along for
9099
# context and to support retries.
91100
if "$error" in outputs:
92-
outputs["$error"] = outputs["$error"] | {
101+
error_dict = {k: outputs["$error"][k] for k in outputs["$error"]}
102+
outputs["$error"] = error_dict | {
93103
"descriptor": descriptor,
94104
"inputs": inputs,
95105
}

0 commit comments

Comments
 (0)