How can I get the Exception object when using a boundary error event?

Hey guys,

Is it possible to get the Exception object (that was raised in a called subprocess) when I use a Boundary Error Event on a Call Activity?
My top process looks like this:

The start event has the async after property set, so the whole process is executed by the internal job executor.
Now let’s say I want to catch a base Business Exception with the Boundary Error Event. How can I get the exact type of the exception, message and stacktrace at the Boundary Error Event or at the Error Handler bean later? Is it even possible?
I tried to use the “Error Code Variable” field without any success. I see the new variable “myError” in the execution variable list, but it always remains null.

Thanks in advance,
Charles

Hey Charles,

at this time it is not possible to access the exception object and also not the stacktrace.
As you have seen in the documentation
in 7.5 it is possible to use the camunda:errorCodeVariable to define a variable, which is set after the error event is cought. Since the 7.6.0-alpha1 version it also possible to set the camunda:errorMessageVariable, which creates a variable that contains the error message.

See the latest documentation.

Is this the information, which you’re looking for?

Best regards,
Chris

Hi Chris,

Thank you very much for your answer. It’s good to hear that from 7.6.0 we will be able to get at least the error message from the catched error. I think that for now we will let the errors propagate to the shared engine’s default failedJob incident handler along with our custom one.

Now is there any way to notify our process application about the occured incidents? We don’t really want to poll the act_ru_incident table from the process application so I am wondering if there was a callback mechanism for pushing these notifications back to our process application.

I tried it using a custom incident handler that was injected to our shared engine (with a custom plugin), but I couldn’t access the beans declared in our process application.
I think it should work somehow, because the engine already does this bean resolution when the process application beans are referenced from the BPMN workflow. I even tried the context switching feature through the ProcessApplicationContext class but it didn’t work for me either.
Am I on the right track with this option (using a custom incident handler + context switching to access the process application’s spring beans from there) or is there any other solution to this problem?

Thanks,
Charles

Hi @Charles,

Could you please provide more details how to catch the error on the boundary error event in the Call activity from post #1?
I try to do sth similar but the error is not triggered.

Thanks!

I’m trying to implement a Boundary Error Event as “catch-all” exceptions handler (including Java runtime exceptions).
Unfortunately, this way, I’m not able to log the stacktrace of the actual exception since the flow goes directly to the Boundary Error event without printing any exception trace. How can I force camunda to log the actual stacktrace and then continue with the Boundary Error event flow?