Trigger Error from inside Task
Closed this issue · 3 comments
elmurd0r commented
Hi,
is it possible to throw an error event from Task A(See Image below) inside an activity event listener so that task B is executed.
listener.on('activity.start', (api) => {
//Throw error event to go to task B
api.throwError();
}
I saw the script task example, but i need the error event in a normal task.
Thanks in advance.
paed01 commented
I might have found a solution for you. Due to the synchronous nature of the engine you probably have to change your task A to a manual task. Otherwise there are some side effects since bpmn:task
will execute immediately. Change the listener to this:
listener.on('activity.wait', (api) => {
api.owner.emitFatal({id: 'SomeId', message: 'thrown in wait'}, {id: api.id});
}
Not so elegant but works.
elmurd0r commented
Thank you very much, it works very well for me.