General Error Handling in Camunda

Hello,

I’m exploring options for implementing a centralized error handling mechanism in Camunda. This is to avoid the need for enclosing each workflow in a subflow with a designated error boundary event.

Our scenario involves tasks frequently interacting with external microservices, using webtarget which may occasionally return exceptions. We also encounter exceptions thrown within our workflows. These exceptions are logged, but they don’t always halt the workflow as intended. While we can attach boundary events to individual tasks, we’re more interested in a universal error handling solution, particularly for handling ResponseStatusExceptions in a way that effectively terminates the flow without generating excessive log entries.

Looking forward to any insights or suggestions. Thank you.

Hi @pertsh.galstyan.
Error boundary events are really more about “business errors”. By that I mean situations, that are not wanted but can occur in your business process.
You shouldn’t model technical exceptions in your process definition.
Also see here:

Those exceptions will lead to incidents in your workflow (you can also configure a possible retry count).
If you want some centralized handling of these incidents, you could write your own incident handler, that could perform needed task when an incident occurs.

Hi @pertsh.galstyan,

Jan is right with the distinction between business and technical errors.

As an alternative to many attached boundary events, you can add a single event based subprocess: Event Subprocess | docs.camunda.org

When the event subprocess is modeled on the level of the main process, it covers the complete runtime of the process instance.

Hope this helps, Ingo