ProcessEngineException not captured in Error Start Event or Error Boundary Event

Hi,
I am using 7.10 version. The issue is that the engine is throwing a ProcessEngineException which I am trying to capture in the error event subprocess but it is not getting triggered.
The scenario is if any type of exception occurs we need to take different workflow.

k8s_first_deployment.bpmn (5.2 KB)

I’m defining java.lang.Exception as errorCode as specified in doc. Please refer the attachment.

Regards,
Hetal

Hi @hetal_rathod,

You should throw a BpmnError instead of a ProcessEngineException: https://docs.camunda.org/manual/7.11/user-guide/process-engine/delegation-code/#throw-bpmn-errors-from-delegation-code

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

Thanks for the quick response. Yea, I have defined my custom errors in Delegates but the RuntimeException thrown by Camunda Engine is not in my control as I directly use the REST API. My scenario is to execute the rollback flow if ANY exception has occurred which is why I used java.lang.Exception as errorCode in errorDefinition.

Regards,
Hetal

Hi @hetal_rathod,

what about doing nothing in case of any exception? The engine won’t commit the transaction with the new state of the process, if any exception is thrown: https://docs.camunda.org/manual/develop/user-guide/process-engine/transactions-in-processes/

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

what about doing nothing in case of any exception? —> In this case the error handler will not have java.lang.Exception, right? It will have the user defined exceptions only. (eg. BpmnError)

We update some third party systems in each service task, so if ANY exception has occurred we need to revert those changes done.
Both the scenarios should be supported by engine. Hope you got my point.

Regards,
Hetal

Hi @hetal_rathod,

could you please upload your Delegate Code to be more specific.

This should be handled by the developer or operator. If something goes wrong in your listeners, you can control the process execution with async continuation or accept the exception in the REST call. An error handler modeled in the BPMN diagram won’t help in this cases.

A best practice is to separate between business errors and technical errors. Business Errors can be handled with BPMN Error Events, technical errors will create incidents in the cockpit.

Hope this helps, Ingo

If I use this then how would I trigger the compensation handlers for the same process?

I read about incidents. Will they trigger the compensation handlers of the process on failures?

We are handling all the possible scenarios in the listeners. We want it be more generic for any exception caught.

The scenario is to execute compensation in case of ANY failure. :frowning_face: