Error handling in flowable BPMN process

Currently I am working on to implement BpmnError handling using error boundary event.
What I observed is that flowable does not support catching exception, thrown as BpmnError from service task’s start/end executionListener. If exception is thrown from service task’s delegate class, then error boundary event can catch.

How can I achieve the error handling in this scenario.


You are correct, BpmnError cannot be thrown from ExecutionListeners.
Likely the best thing you can do is catch the exception, create a transient variable and test for this in your Service Delegate. If there was an exception, throw the BpmnError from the delegate.

It’s a little harder for the End event since the Delegate has already been processed. You could again set a variable and use a gateway after the task to test the error and handle.

Obviously not ideal.

I would prefer to change ActivityBehavior to support BpmnError handlling.

something similar as: