cancel
Showing results for 
Search instead for 
Did you mean: 

When to use an Error End Event?

zlatan316
Champ on-the-rise
Champ on-the-rise
Im currently learning about the Error Handling side of Activiti and I was just wondering, when would I ever need to handle errors if it is already being done in my Java code? I know the designers of Activiti have made a logical decision to implement it, but I cannot see why yet and would like some guidanceSmiley Happy

For example, if I had a Service Task which set an errorVariable to true if an error was caught, why can I not just use an Exclusive Gateway to check this variable has been set to true, then run a class which handles the error and then finishes the flow with an End Event?
1 REPLY 1

tstephen
Champ on-the-rise
Champ on-the-rise
A BPMN end error event is actually a way to throw rather than catch (or handle) an error. So your process can define two (or more) end events one for the 'normal' case and one for the error. Why you would want to do this depends largely on whether you are throwing an error from a process to a 'higher' process that started it or to the code that started it (for instance the Java code that embeds Activiti).

The user guide puts it this way:
<blockcode>
When process execution arrives in an error end event, the current path of execution is ended and an error is thrown. This error can caught by a matching intermediate boundary error event. In case no matching boundary error event is found, an exception will be thrown.
</blockcode>