use of org.kie.kogito.process.validation.ValidationContext in project kogito-runtimes by kiegroup.
the class ProcessCodegen method handleValidation.
private static void handleValidation() {
ValidationContext validationContext = ValidationContext.get();
if (validationContext.hasErrors()) {
// we may provide different validation decorators, for now just in logging in the console
ValidationLogDecorator decorator = ValidationLogDecorator.of(validationContext).decorate();
Optional<Exception> cause = validationContext.exception();
// rethrow exception to break the flow after decoration
try {
throw new ProcessCodegenException(decorator.simpleMessage(), cause);
} finally {
validationContext.clear();
}
}
}
Aggregations