Why did this error event not trigger

Hello my friend!
Welcome to Camunda Community! \o/

You can use a try/catch in your java delegate to catch the error that occurred, and handle this exception by throwing new BpmnError.

in BpmnError the first parameter is the Global Message Reference that you must place in your Error Boundary Event, and the second parameter is any additional message that you want to send to inform the error that occurred. In the example below, I just took the Exception message that occurred, and threw this same message into Camunda through BpmnError.

public class TestDelegateCode implements JavaDelegate {
    @Override
    public void execute(DelegateExecution execution) throws Exception {
        try {
             your logic code here!
            }
        } catch (Exception e) {
            throw new BpmnError("GlobalErrorReferenceName", e.getMessage());
        }
    }
}

I hope this helps!

William Robert Alves

1 Like