Hello, currently I’m trying to figure out how to handle exceptions in my custom parse listener plugin. I want to check the deployed diagram for inputs that are not allowed. For that, I extended the AbstractBpmnParseListener
and created an exception that extends the ProcessEngineException
.
public class ParseListener extends AbstractBpmnParseListener {
private void validateIoMapping(Element element) {
element.element("inputOutput").elements().forEach(element1 -> {
String attributeName = element1.attribute("name");
if (!ALLOWED_INPUT_PARAMETER_NAMES.contains(attributeName)) {
throw new ElementNotAllowedException(element);
}
});
}
@Override
public void parseIoMapping(Element extensionElements, ActivityImpl activity, IoMapping inputOutput) {
validateIoMapping(extensionElements);
}
}
Now, when I deploy a diagram with repositoryService.createDeployment()
and surround it in a try-catch block, the exception is still written in my stack trace. What would be the proper way to catch the exception and handle it?
2024-07-21T22:13:52.512+02:00 ERROR 20159 --- [nio-8081-exec-1] org.camunda.bpm.engine.bpmn.parser : ENGINE-01004 Unexpected Exception with message: Inputs not supported in: <manualTask...
2024-07-21T22:13:52.513+02:00 ERROR 20159 --- [nio-8081-exec-1] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: ENGINE-01009 Error while parsing process. Inputs not supported in: <manualTask....
org.camunda.bpm.engine.ProcessEngineException: ENGINE-01009 Error while parsing process. Inputs not supported in: <manualTask....