public void handleException(ExceptionHandler handler, String exception, Object params) { if (handler instanceof ActionExceptionHandler) { ActionExceptionHandler exceptionHandler = (ActionExceptionHandler) handler; Action action = (Action) exceptionHandler.getAction().getMetaData("Action"); try { ProcessInstance processInstance = getProcessInstance(); ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime()); ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer(); if (contextInstanceContainer instanceof NodeInstance) { processContext.setNodeInstance((NodeInstance) contextInstanceContainer); } else { processContext.setProcessInstance(processInstance); } String faultVariable = exceptionHandler.getFaultVariable(); if (faultVariable != null) { processContext.setVariable(faultVariable, params); } action.execute(processContext); } catch (Exception e) { throw new RuntimeException("unable to execute Action", e); } } else { throw new IllegalArgumentException("Unknown exception handler " + handler); } }
public void handleException(ExceptionHandler handler, String exception, Object params) { if (handler instanceof ActionExceptionHandler) { ActionExceptionHandler exceptionHandler = (ActionExceptionHandler) handler; Action action = (Action) exceptionHandler.getAction().getMetaData("Action"); try { ProcessInstance processInstance = getProcessInstance(); ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime()); ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer(); if (contextInstanceContainer instanceof NodeInstance) { processContext.setNodeInstance((NodeInstance) contextInstanceContainer); } else { processContext.setProcessInstance(processInstance); } String faultVariable = exceptionHandler.getFaultVariable(); if (faultVariable != null) { processContext.setVariable(faultVariable, params); } action.execute(processContext); } catch (Exception e) { throw new RuntimeException("unable to execute Action", e); } } else { throw new IllegalArgumentException("Unknown exception handler " + handler); } }