Skip to content

Commit 17e5b46

Browse files
committed
[core] Ensure call failures are propagated correctly
1 parent f26d477 commit 17e5b46

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/workflow/callable/call.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
package callable
2626

2727
import (
28+
"errors"
2829
"fmt"
2930
"sort"
3031
"strconv"
@@ -221,6 +222,12 @@ func (c *Call) Call() error {
221222
if len(returnVar) > 0 {
222223
c.parentRole.SetRuntimeVar(returnVar, output)
223224
}
225+
226+
// if __call_error was written into the VarStack we treat it as an error exit from the call
227+
if errMsg, ok := c.VarStack["__call_error"]; ok && len(errMsg) > 0 {
228+
return errors.New(errMsg)
229+
}
230+
224231
return nil
225232
}
226233

@@ -236,6 +243,7 @@ func (c *Call) Start() {
236243
}
237244

238245
func (c *Call) Await() error {
246+
log.Trace("awaiting " + c.Func + " in trigger phase " + c.Traits.Await)
239247
return <-c.await
240248
}
241249

0 commit comments

Comments
 (0)