public void execute(DelegateExecution execution) throws Exception { throw new BpmnError("org.camunda.bpm.qa.upgrade.BuisnessError", "Expected exception"); } }
@Override public void mapOutputVariables(DelegateExecution superExecution, VariableScope subInstance) { throw new BpmnError("1234"); } }
@Override public void execute(DelegateExecution execution) throws Exception { throw new BpmnError("E1"); } }
@Override public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception { throw new BpmnError("23", "Testing bpmn error in SignallableActivityBehaviour#signal"); } }
@Override public void execute(DelegateExecution execution) throws Exception { throw new BpmnError(ERROR_CODE); }
public void execute(DelegateExecution execution) throws Exception { if (firstAttempt) { throw new BpmnError("It is supposed to fail."); } }
@Override public void execute(DelegateExecution execution) throws Exception { throw new BpmnError("errorCode", "ouch!"); }
@Override public void mapInputVariables(DelegateExecution superExecution, VariableMap subVariables) { throw new BpmnError("1234"); }
public void throwBpmnError() { throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event."); }
protected void throwErrorIfRequested(DelegateExecution execution) { Boolean shouldThrowError = (Boolean) execution.getVariable(ERROR_INDICATOR_VARIABLE); if (Boolean.TRUE.equals(shouldThrowError)) { String errorName = (String) execution.getVariable(ERROR_NAME_VARIABLE); if (errorName == null) { errorName = DEFAULT_ERROR_NAME; } throw new BpmnError(errorName); } }
public void execute(DelegateExecution execution) throws Exception { Object shouldThrowError = execution.getVariable("shouldThrowError"); if (shouldThrowError != null) { throw new BpmnError("error"); } } }
public void bpmnError(String errorCode, String errorMessage, Map<String, Object> variables) { ensureActive(); ActivityExecution activityExecution = getExecution(); BpmnError bpmnError = null; if (errorMessage != null) { bpmnError = new BpmnError(errorCode, errorMessage); } else { bpmnError = new BpmnError(errorCode); } try { ExternalTaskActivityBehavior behavior = ((ExternalTaskActivityBehavior) activityExecution.getActivity().getActivityBehavior()); if (variables != null && !variables.isEmpty()) { activityExecution.setVariables(variables); } behavior.propagateBpmnError(bpmnError, activityExecution); } catch (Exception ex) { throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex); } }
public void bpmnError(String errorCode, String errorMessage, Map<String, Object> variables) { ensureActive(); ActivityExecution activityExecution = getExecution(); BpmnError bpmnError = null; if (errorMessage != null) { bpmnError = new BpmnError(errorCode, errorMessage); } else { bpmnError = new BpmnError(errorCode); } try { ExternalTaskActivityBehavior behavior = ((ExternalTaskActivityBehavior) activityExecution.getActivity().getActivityBehavior()); if (variables != null && !variables.isEmpty()) { activityExecution.setVariables(variables); } behavior.propagateBpmnError(bpmnError, activityExecution); } catch (Exception ex) { throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex); } }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn") public void FAILING_testBpmnErrorInScriptInputMapping() { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("throwInMapping", "in"); variables.put("exception", new BpmnError("error")); runtimeService.startProcessInstanceByKey("testProcess", variables); //we will only reach the user task if the BPMNError from the script was handled by the boundary event Task task = taskService.createTaskQuery().singleResult(); assertThat(task.getName(), is("User Task")); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn") public void FAILING_testBpmnErrorInScriptOutputMapping() { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("throwInMapping", "out"); variables.put("exception", new BpmnError("error")); runtimeService.startProcessInstanceByKey("testProcess", variables); //we will only reach the user task if the BPMNError from the script was handled by the boundary event Task task = taskService.createTaskQuery().singleResult(); assertThat(task.getName(), is("User Task")); }
protected void handle(ActivityExecution execution, String action) throws Exception { execution.setVariable(action, true); String type = (String) execution.getVariable("type"); if ("error".equalsIgnoreCase(type)) { throw new BpmnError("MyError"); } else if ("exception".equalsIgnoreCase(type)) { throw new MyBusinessException("MyException"); } else if ("leave".equalsIgnoreCase(type)) { execution.setVariable("type", null); leave(execution); } }
protected void handle(ActivityExecution execution, String action) throws Exception { execution.setVariable(action, true); String type = (String) execution.getVariable("type"); if ("error".equalsIgnoreCase(type)) { throw new BpmnError("MyError"); } else if ("exception".equalsIgnoreCase(type)) { throw new MyBusinessException("MyException"); } else if ("leave".equalsIgnoreCase(type)) { execution.setVariable("type", null); leave(execution); } }
public void execute(DelegateExecution execution) throws Exception { Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError"); Integer executions = (Integer) execution.getVariable("executions"); Boolean exceptionType = (Boolean) execution.getVariable("exceptionType"); if (executions == null) { executions = 0; } executions++; if (executionsBeforeError == null || executionsBeforeError < executions) { if (exceptionType != null && exceptionType) { throw new MyBusinessException("This is a business exception, which can be caught by a BPMN Error Event."); } else { throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event."); } } else { execution.setVariable("executions", executions); } }
public void execute(DelegateExecution execution) throws Exception { if (firstAttempt) { throw new BpmnError("It is supposed to fail."); } }
/** * The mock will throw a BpmnError with given errorCode. * * @param errorCode * the error code */ public void onExecutionThrowBpmnError(final String errorCode) { onExecutionThrowBpmnError(new BpmnError(errorCode)); }