Error handling in flowable BPMN process

Hi,
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.

Thanks,
Prasanta

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:

Regards
Martin

@prasanta @gdharley
FYI: Support for throwing BpmnError from Execution Listeners is soon going to be merged and released with Flowable 6.8.0: #3452 Support throwing BPMNError from executionListeners by arthware · Pull Request #3481 · flowable/flowable-engine · GitHub

Edit:
PR has been merged to main. BpmnErrors thrown from Execution Listeners are now propagated in the model. Please read the doc snippet: #3452 Support throwing BPMNError from executionListeners (docs) · flowable/flowable-engine@bf4cc43 · GitHub

1 Like