Skip to content

Commit ed96710

Browse files
committed
Fix sublfow error handler cannot throw error back to main flow
1 parent d87b2c2 commit ed96710

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

instance/instances.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package instance
33
import (
44
"errors"
55
"fmt"
6-
76
"github.com/project-flogo/core/support"
87
"github.com/project-flogo/core/support/log"
98
"github.com/project-flogo/flow/definition"
@@ -382,7 +381,20 @@ func (inst *IndependentInstance) handleTaskError(taskBehavior model.TaskBehavior
382381
} else {
383382
if containerInst.isHandlingError {
384383
//fail
385-
inst.SetStatus(model.FlowStatusFailed)
384+
containerInst.SetStatus(model.FlowStatusFailed)
385+
if containerInst != inst.Instance {
386+
// spawned from task instance
387+
host, ok := containerInst.host.(*TaskInst)
388+
389+
if ok {
390+
behavior := inst.flowModel.GetDefaultTaskBehavior()
391+
if typeID := host.task.TypeID(); typeID != "" {
392+
behavior = inst.flowModel.GetTaskBehavior(typeID)
393+
}
394+
inst.handleTaskError(behavior, host, err)
395+
}
396+
}
397+
386398
} else {
387399
taskInst.appendErrorData(err)
388400
inst.HandleGlobalError(containerInst, err)

0 commit comments

Comments
 (0)