Trigger Error event using API

Hi guys,

I am trying to make a bpmn model where we have used a boundary error event which will be assumed to trigger on failing a REST call or exception occurred from a REST call.

I am curious that whether an error event can be trigger like a signal event(which can be done using code:- runtimeService.signalEventReceivedAsync(signal, execution.getId()) ). Similarly can I trigger an error event using any api while the current execution is on a user task. or how should I properly throw a BpmnError from a user task.

Joyal Joy

Hey @joyal.joy777,

You cannot trigger a bpmn error through the public API.

Why don’t you use a Signal Boundary event instead of an Error boundary event?


Hi @filiphr,

Thanks for the reply.

So the context is more related with dealing an error which occurred in the middle of an active task. For example I am doing a user task which in turn calls a rest service via an event listener which leads to error(could be a n/w failure, server failure or some exception). So I want to consider the situation while modeling. So an error event make more sense than a signal event. Can I throw a BpmnError somehow in the active task?

Hey @joyal.joy777,

OK it makes sense now.

What kind of event listener. Is it happening after the task is being completed (in which case you can’t throw a BPMN error, nor a signal). You’ll have to do that with a service task. Otherwise I’ll advise you to have a look at ErrorThrowingEventListener and do something similar in your event listener as well