@@ -45,13 +45,22 @@ def _processCompletedNode(
45
45
if outputs .get ("$error" ) and not any (e .out == "$error" for e in newOpportunities ):
46
46
# If the node threw an exception and it wasn't routed via $error,
47
47
# 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
+ )
55
64
56
65
@staticmethod
57
66
async def processAllPendingNodes (
@@ -89,7 +98,8 @@ async def _promise():
89
98
# If not already present, add inputs and descriptor along for
90
99
# context and to support retries.
91
100
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 | {
93
103
"descriptor" : descriptor ,
94
104
"inputs" : inputs ,
95
105
}
0 commit comments