Error End Event to pass dynamic error message

Hi,

From my Expression if certain condition fail then I need to throw Error End Event and that will be caught in a Error Start event to log the error and proceed further. Error Start event is common across the project. Now I want to pass a message with Error End Event so, the error can be logged for different error. So, how Error End Event can pass ‘Message Variable’ while throwing the error.

Hello @Souvik_Bhattacharya ,

a error has a message field. This message can be mapped to a variable. This can be configured in the message start event.

The error message can be configured in the error end event.

I hope this helps

Jonathan

Can you provide bit more details on this? When I put a string in message for Error End Event then the same message is shown in Error Start Event but I want it to be dynamic for different error end event.

Hello @Souvik_Bhattacharya ,

if I am not completely mistaken, the message can be an expression as well. So you could create a variable that holds the error message.

For better visibility, you could also define multiple error end events that are caught in one error start event. Your process will then not hide the information which error occured.

Jonathan

1 Like

Hi,

In that case we need to set the variable in some script task and then can pass it as an ‘expression’ right? But then can you define it directly in error end event?

Hello @Souvik_Bhattacharya ,

you could, yes. My idea with the script was that you can compose data provided (for example error details) to compose an individual message.

Jonathan

Hi @jonathan.lukas - Can we make error code also dynamic? I have requirement to pass different error codes. Can we set it to variable and use it as expression?

Hello @Bhavik ,

the error code can be a feel function, so yes.

Jonathan

Hi @jonathan.lukas - Thanks for the reply.

Can you please share an example. Because when I try to set “Code” under Error end event as variable in modeler it doesn’t set the value rather it takes that variable as value only.

Hello @Bhavik ,

the properties of the error end event should look like this:

Jonathan

Hi @jonathan.lukas - I believe example you shared is for BPMN using Camunda 8. is it possible using camunda 7? Thanks

Hello @Bhavik ,

stupid me! :stuck_out_tongue:

No, in Camunda 7, it is not possible to throw an error from an end event using an expression for the code.

Jonathan

1 Like

Hi @jonathan.lukas - Thanks for the confirmation :slight_smile:

1 Like