ErrorHandling in Embedded Suprocess

Hi!

i have a problem with ErrorHandling in embedded subprocesses. I hope someone can help me.

This is my bpmn:
diagram_1.bpmn (11.2 KB)

Before the embedded subprocess i create a list of orders and for each order the subprocess is executed.
After the subprocess the order will be send to the customer.

For example i got 3 orders from one customer in the list. The subprocess will be executed 3 times. Two orders reach the EndEvent of the subprocess. But the last Order runs into the ErrorEndEvent.

In my case i want to dispatch the two succesfull orders and the incorrect order should be handled in the ErrorSubProcess.

Now i have the following problem: Since the 3rd Order was incorret and ran into the ErrorEndEvent, the whole ProcessInstance is terminated. Therefore the 2 correct orders cant be dispatched.

Is there any way to change my model to reflect the use case?

Best Regards :slight_smile:

Putting the event sub process into the embedded sub process will mean that for each error it will be handled independently of the others, so if one has an error it wont affect the others:

1 Like

Okay, thank you!

Another question: If i have mutliple embedded subprocesses in this main process, then i have to add the event sub process in every embedded subprocess? Or is there a more elegant way?

If they’re all multi-instnace and you need them to catch an error for a specific one - then this is probably the best solution. although maybe my buddy @Hafflgav could have some other ideas.

Hello @Niall,

I have a Problem with my process. I implemented it with an event subprocess into the embedded subprocess.
Now i have the following problem:
When i recieve one order, the subprocess is executed once. The instance reaches the ErrorEndEvent, because something was wrong with it. After that the error event subprocess is executed. But once the event subprocess is finished the process instance moves on with the next task in the processmodell after the “subprocess executed per order”. In my case its another embedded subprocess.

I expected the process instance to be terminated because it had reached the EndEvent in the Error Event Subprocess. But actually it skips the “normal” EndEvent of the embedded subprocess and continues with the next task after the embedded subprocess.

I would like to implement the following behaviour:
1 wrong order → 1 execution embedded subprocess → reaches ErrorEndEvent → continues with the ErrorSubprocess → whole execution is stopped, because there was only 1 Order which has an Error.
3 order with 1 wrong order → 3 executions in embedded subprocess → 2 orders reaches EndEvent1 of embedded Subprocess → wrong order reaches ErrorEndEvent → continues with the ErrorSubprocess → Execution continues with the 2 correct orders. → The second embedded Subprocess should be executed twice for the remaining 2 correct orders.

I hope this clarifies my intent :slight_smile:

Can you upload your model so it’s a little easier to follow?
Thanks :slight_smile:

diagram_1.bpmn (13.6 KB)

My Problem with renamed Tasks and Events:
First embedded Subprocess is executed once for 1 wrong order. The instance reaches the ErrorEndEvent. After that the ErrorSubprocess ist executed and reaches the Endevent 2.

Now i expect the process Instance to be terminated. But it actually skips Endevent1 and continues with Task E.

Thank you :slight_smile:

The issue here is with the scope of the even sub process. the interrupting error catch event doesn’t actually end a process instance by design - it just kills all tokens in the current scope. So if it was outside the sub process it would kill the process but the scope you have defined just means that it will end the single instance of that sub process. If you want to end the process you’d need to re-throw the error as an end event .

you can set a variable on start listener of sub process and at end event (EndEvent1) like ${execution.setVariable(‘continueProcess’,false)} and ${execution.setVariable(‘continueProcess’,true)} respectively, add an exclusice gateway and check for the condition outside sub process and end the process

diagram_1.bpmn (15.5 KB)