Unable to catch bpmn error

Hello,

I’ve recently started learning about camunda and the reference items. In one of the examples i’m trying to test the error boundary event that’s attached to an external service task. So the idea here is that during the service execution if there’s an exception it’ll throw the particular bpmn error, which will be caught by the boundary event and take it’s course to the next step. I’ve defined the bpmn error in a variable name and gave that name under Code Variable on the error boundary event, and this variable is populated with the error name that’ll be thrown from the service task. I’m getting null error as below and i’ve ran out of ideas on what’s happening. Please help

Error: org.camunda.bpm.engine.delegate.BpmnError: null
at com.walmart.omnisage.executionservices.flows.DummyProcessWithMessage.lambda$7(DummyProcessWithMessage.java:157)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.handleExternalTask(TopicSubscriptionManager.java:152)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.lambda$acquire$0(TopicSubscriptionManager.java:108)
at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:103)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:87)
at java.base/java.lang.Thread.run(Thread.java:834)

One thing i noticed is that the error boundary event doesn’t have ‘error’ properties in the detail panel as seen in multiple tutorial videos. How can i get those properties to showup ?

Are you writing anything similar to this in your code?

throw new org.camunda.bpm.engine.delegate.BpmnError(“foodPoison”)

In addition to defining the Error properties in your screenshot, additional code would be necessary to successfully get our patient to the hospital!

Here is an example by Stephen that could help:

Also do attach your model next time, it helps everyone help you!

Yes, i am throwing this error from my external task like below. Regarding the model, sorry i wanted to upload but it’s too big and has some company information in it so i’m afraid i cannot upload the bpmn file. Do you know why the details pane on the side doesn’t show error code, error name etc., fields ? like shows in multiple error handling videos.

@ExternalTaskSubscription(topicName = “eatDinner”)
@Bean
public ExternalTaskHandler eatDinnerExternalTaskHandler() {
return (externalTask, externalTaskService) → {
log.info(“handling eat dinner task”);
throw new BpmnError(“foodPoison”);
};
}

Hi @kallsas,

in an external task client, you could not simply throw the BPMN error. You have to send it to the process engine with this command:

externalTaskService.handleBpmnError(externalTask, "errorCode");

The error code has to be “foodPoison” in your example.

Hope this helps, Ingo

3 Likes

Thanks @Ingo_Richtsmeier while i was waiting for a reply over here, i found this thread (Error message of BPMN error from external task - #5 by RAMABATHIRANK) and it has the same information as you’ve pointed out here. This is now resolved.

thanks for the help guys, appreciate it.