Is it possible to execute the boundary error without using a Error End event?
If not I can make the End event as a Error End event which is inside sub process. And, then How can I link the Error End event and Boundary error programmatically? Also, Need to call the Error End event directly from the event which is throwing the exception (Event/Task where occurred the error).
Lets assume there is an error in “Service Task 1” then directly needs to execute End Event and complete the sub process by calling the boundary event.
Finally, If all the previous scenarios are impossible then, is there a way to end the process inside sub process event and call the Boundary error?
So basically all of the scenarios that you mentioned are possible.
I would suggest throwing the BPMN Error directly from your service task by using the
throw new BPMNError("someErrorCode");
As long as the error code on the boundary event matches the one throw in the code it will be caught.
Thank you for answering my question. Actually, mostly the errors will be thowing from gateways. Is it possible to have BpmnError there? because I got issues with that. That is why I decided to directly execute end event and call the Boundary error from there.
Yes. I can do that but, I am not defining error events for all gateways and trying to make a common way to handle errors for gateways using a expression and throw the error from there. Therefore I tried to dynamically add events to the gateway outgoing sequence flow and execute it. And, then do a process migration. Is there a easy way to achieve this goal?
Will it be worked if I throw the Bpmn error in gateway and defined the global error sub process?
I would avoid having to use gateways for this it will make the model took really busy.
The global error handler would catch any errors thrown by any service task. There isn’t a need to add gateways at all.
Thank you so much for explaining the solution clearly. I can make the global error event and throw the bpmn error in each service. Is there a way to validate gateways without using a default error event for each gateway? Otherwise if any variable is missing or empty then the process will be waiiting.
If there is no way to handle errors in gateways, then can you provide me steps need to follow to directly call the end event in the process and ending the processs there without continuing back where catched the exception?
I can’t guaranty that any gateway variable will be in the execution at the time I am checking that in bpmn.
And, the reason I am using gateway validation is the main process contains lots of sub processes.