cancel
Showing results for 
Search instead for 
Did you mean: 

Exception Handling by error boundary

akakunin
Champ in-the-making
Champ in-the-making
Hi!

Is it possible to catch java exceptions (may be happens during process execution) by using error-boundary element?
If not - what a good strategy for it?
I need in case some java exception happens during process execution run special "compensation" subprocess - error-bounudary looks like a most comfortable way for it
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

An error boundary event is a logical error inside a process definition, so no support for Java exceptions there.
In other words, you can throw a logical error using a error end event that can be caught be an error boundary event.
But you can catch a Java exception within a Java service task and take an error sequence flow from there.
So you can add two sequence flows to the Java service task, one for normal process flow (without the exception occurring),  and one for error process flow with the sub process you want to execute in case an exception does occur inside the Java service task.
To implement the error routing logic in a Java service task you should implement the ActivityBehaviour interface instead of a JavaDelegate.

You can find more information in the userguide, under Java service task - Handling exceptions.

Best regards,