use of org.kie.internal.runtime.error.ExecutionError.Builder in project jbpm by kiegroup.
the class TaskExecutionErrorFilter method filter.
@Override
public ExecutionError filter(ExecutionErrorContext errorContext) {
if (isCausedBy(errorContext.getCause(), PermissionDeniedException.class)) {
return null;
}
Builder taskErrorBuilder = ExecutionError.builder().type(TYPE).initActivityId(getInitActivityId(errorContext));
TaskException exception = extract(errorContext.getCause(), TaskException.class);
String stacktrace = getStackTrace(exception);
Task task = errorContext.getLastExecutedTask();
if (task != null) {
taskErrorBuilder.deploymentId(task.getTaskData().getDeploymentId()).processInstanceId(task.getTaskData().getProcessInstanceId()).processId(task.getTaskData().getProcessId()).activityId(task.getId()).activityName(task.getName());
}
return taskErrorBuilder.message(exception.getMessage()).error(stacktrace).errorDate(new Date()).build();
}
use of org.kie.internal.runtime.error.ExecutionError.Builder in project jbpm by kiegroup.
the class DBExecutionErrorFilter method filter.
@Override
public ExecutionError filter(ExecutionErrorContext errorContext) {
Builder errorBuilder = ExecutionError.builder().type(TYPE).initActivityId(getInitActivityId(errorContext));
String stacktrace = getStackTrace(errorContext.getCause());
Task task = errorContext.getLastExecutedTask();
NodeInstance nodeInstance = errorContext.getLastExecutedNode();
logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task);
if (nodeInstance != null) {
logger.debug("Last executed node instance {} will be used to populate error details", nodeInstance);
errorBuilder.deploymentId(((ProcessInstanceImpl) nodeInstance.getProcessInstance()).getDeploymentId()).processInstanceId(nodeInstance.getProcessInstance().getId()).processId(nodeInstance.getProcessInstance().getProcessId()).activityId(nodeInstance.getId()).activityName(nodeName(nodeInstance));
} else if (task != null) {
logger.debug("Last executed task {} will be used to populate error details", task);
errorBuilder.deploymentId(task.getTaskData().getDeploymentId()).processInstanceId(task.getTaskData().getProcessInstanceId()).processId(task.getTaskData().getProcessId()).activityId(task.getId()).activityName(task.getName());
}
return errorBuilder.message(errorContext.getCause().getMessage()).error(stacktrace).errorDate(new Date()).build();
}
Aggregations