this is my first post in Camunda forum. I have a maker checker BPMN diagram as follow.
I am able to call REST API Complete Task | docs.camunda.org to complete the user task (Checker Task), I would like to ask how to catch and return the error message via REST API if there’s exception being thrown in the service task (Store in master table or do nothing). Please let me know if my current workflow design is wrong.
It depends on how exactly your running the code in the service task - Can you explain if you’re running a java class or you’re using an external task.
If you’re running java code please post it up and explain how you’d like the error to be caught.
Hi @Niall I´m running a similar process and I want to catch and return exception with rest API. The error type is a business error and the service task is running as an external task. Is there a way to make this execution with REST API?diagram_1.bpmn (9.1 KB)
If you dont have any async before/after marked in your tasks, when you complete the user task, the next service tasks will execute in the same thread, so if it throws any exception you will get them and camunda will do a rollback to the last wait state (in this case your user task).
I think you should remove the error boundary event in this scenario. The way you made it, you are not letting the exception throw normally. You are catching and creating a new user task. If you want the error to go up, just dont catch it with an error event, and make sure theres no async before/after between the user task, exclusive gateway and service task.
Sorry @anchor, i saw now that you are using an External task… external tasks are always wait states, because it will wait for a worker to get it and complete. It isnt executed in the same thread neither in the same time of your user task completion, so theres no way to catch it, because your REST http call already completes before any worker do the external task job. If you change it to a JavaDelegate or script task then you could make the way i said in my other answer