Skip to content

Commit

Permalink
Re-raise python exceptions in pythonboard for more information
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Xiao committed Oct 31, 2023
1 parent 7ced9cc commit 4bace43
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions seeds/pythonboard/src/traversal/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ def _processCompletedNode(
if outputs.get("$error") and not any(e.out == "$error" for e in newOpportunities):
# If the node threw an exception and it wasn't routed via $error,
# throw it again. This will cause the traversal to stop.
raise Exception(
"Uncaught exception in node handler. " +
"Catch by wiring up the $error output.",
{
"cause": outputs["$error"],
}
)
if isinstance(outputs.get("$error").error, Exception):
raise Exception(
"Uncaught exception in node handler. " +
"Catch by wiring up the $error output.",
{
"cause": outputs["$error"],
}
) from outputs.get("$error").error
else:
raise Exception(
"Uncaught exception in node handler. " +
"Catch by wiring up the $error output.",
{
"cause": outputs["$error"],
}
)

@staticmethod
async def processAllPendingNodes(
Expand Down Expand Up @@ -89,7 +98,8 @@ async def _promise():
# If not already present, add inputs and descriptor along for
# context and to support retries.
if "$error" in outputs:
outputs["$error"] = outputs["$error"] | {
error_dict = {k: outputs["$error"][k] for k in outputs["$error"]}
outputs["$error"] = error_dict | {
"descriptor": descriptor,
"inputs": inputs,
}
Expand Down

0 comments on commit 4bace43

Please sign in to comment.