Search in sources :

Example 1 with ExecutionErrorContext

use of org.kie.internal.runtime.error.ExecutionErrorContext in project jbpm by kiegroup.

the class ExecutionErrorHandlerImpl method handle.

@Override
public void handle(Throwable cause) {
    ExecutionErrorContext errorContext = new ExecutionErrorContext(cause, lastExecutedNode, lastExecutedTask, firstExecutedNode);
    for (ExecutionErrorFilter filter : filters) {
        if (filter.accept(errorContext)) {
            ExecutionError error = filter.filter(errorContext);
            logger.debug("Filter {} returned {} for {}", filter, error, cause);
            if (error != null) {
                try {
                    storage.store(error);
                    logger.debug("Error event {} stored successfully in {}", error, storage);
                } catch (Throwable e) {
                    logger.warn("Could not persist execution error {} due to {}", error, e.getMessage());
                    logger.debug("Stack trace ", e);
                }
            } else {
                logger.debug("Filter {} accepted error {} but didn't produce results (error should be ignored)", filter, cause);
            }
            return;
        }
    }
    // in case it ended up here - meaning not filters dealt with it, simply log the error
    logger.error("Unexpected error during processing ", cause);
}
Also used : ExecutionError(org.kie.internal.runtime.error.ExecutionError) ExecutionErrorContext(org.kie.internal.runtime.error.ExecutionErrorContext) ExecutionErrorFilter(org.kie.internal.runtime.error.ExecutionErrorFilter)

Aggregations

ExecutionError (org.kie.internal.runtime.error.ExecutionError)1 ExecutionErrorContext (org.kie.internal.runtime.error.ExecutionErrorContext)1 ExecutionErrorFilter (org.kie.internal.runtime.error.ExecutionErrorFilter)1