I have a 3 delegate classes that have similar below code. I’m setting the createConnectorStatus, topicCreateStatus and kestraCreateStatus to false if the exception is triggered:
catch (IllegalArgumentException e){
log.warn(“Business error while creating connectorForm”, e);
execution.setVariable(“createConnectorStatus”, false);
execution.setVariable(“errorMessage”, e.getMessage());
throw new BpmnError(“CREATE_CONNECTOR_ERROR”, e.getMessage());
}
I’m reading the status of those variables (createConnectorStatus, topicCreateStatus and kestraCreateStatus) in the controller and return 400 error response if any is false as below:
if (Boolean.FALSE.equals(responseVars.get(“kestraCreateStatus”))
|| Boolean.FALSE.equals(responseVars.get(“topicCreateStatus”))
|| Boolean.FALSE.equals(responseVars.get(“createConnectorStatus”))) {
String errorMessage = String.valueOf(responseVars.get(“errorMessage”));
throw new IllegalArgumentException("Error while creating connector: " + errorMessage);
}
I wanted to know is there a way to do that from the modeler? or is this a best practice?
