@Override public String getMessage() { return MessageFormat.format("[{0}:{4} - {1}:{2}] -- {3}", getProcessId(), (getNodeName() == null ? "?" : getNodeName()), (getNodeId() == 0 ? "?" : getNodeId()), (getCause() == null ? getMessage() : getCause().getMessage()), getProcessInstanceId()); }
@Override public ExecutionError filter(ExecutionErrorContext errorContext) { WorkflowRuntimeException exception = extract(errorContext.getCause(), WorkflowRuntimeException.class); String stacktrace = getStackTrace(errorContext.getCause()); return ExecutionError.builder() .type(TYPE) .initActivityId(getInitActivityId(errorContext)) .deploymentId(exception.getDeploymentId()) .processInstanceId(exception.getProcessInstanceId()) .processId(exception.getProcessId()) .activityId(exception.getNodeInstanceId()) .activityName(exception.getNodeName()) .message(exception.getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }
@Override public String getMessage() { return MessageFormat.format("[{0}:{4} - {1}:{2}] -- {3}", getProcessId(), (getNodeName() == null ? "?" : getNodeName()), (getNodeId() == 0 ? "?" : getNodeId()), (getCause() == null ? getMessage() : getCause().getMessage()), getProcessInstanceId()); }
public static void runExample() { RuntimeManager manager = createManager(); KieSession ksession = manager.getRuntimeEngine(null).getKieSession(); Map<String, Object> params = new HashMap<String, Object>(); String varName = "var1"; params.put( varName , "valueOne" ); try { ksession.startProcess("ExceptionScriptTask", params); } catch( WorkflowRuntimeException wfre ) { String msg = "An exception happened in " + "process instance [" + wfre.getProcessInstanceId() + "] of process [" + wfre.getProcessId() + "] in node [id: " + wfre.getNodeId() + ", name: " + wfre.getNodeName() + "] and variable " + varName + " had the value [" + wfre.getVariables().get(varName) + "]"; System.out.println(msg); } manager.close(); }
@Override public ExecutionError filter(ExecutionErrorContext errorContext) { WorkflowRuntimeException exception = extract(errorContext.getCause(), WorkflowRuntimeException.class); String stacktrace = getStackTrace(errorContext.getCause()); return ExecutionError.builder() .type(TYPE) .initActivityId(getInitActivityId(errorContext)) .deploymentId(exception.getDeploymentId()) .processInstanceId(exception.getProcessInstanceId()) .processId(exception.getProcessId()) .activityId(exception.getNodeInstanceId()) .activityName(exception.getNodeName()) .message(exception.getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }