I have a convenience Method to create incidents for non-handled bpmn errors triggered through an external task handler so that I don't have to program this logic explicitly.
Problem
Context: as developer, I want to create reusable external task handlers.
The person using the handler in different bpmn processes should be able to opt-in to explicitly handle errors that occur in the external task handler via BPMN Error Catch events or not. If an error is not handled explicitly an incident should be raised.
I can already do that by adding logic to my handler which always first tries to raise a bpmn error and if that is unsuccessful, then communicate a failure (leading to an incident).
It would be nice to have a convenience method for this to do that in one single call.
Currently I have to write
// do work if (successful) { complete(); } else { boolean couldRaiseError = tryRaiseBPMNError(); if (!couldRaiseError) { raiseFailure(); } }
I would want to write
// do work if (successful) { complete(); } else { tryRaiseErrorOrRaiseFailure() }
AC:
- There is a convenient way to try raise a BPMN error or create an incident in one method call