private static void handleStepExecutionException(Execution execution, RuntimeException ex) { logger.error("Error occurred during operation execution. Execution id: " + execution.getExecutionId(), ex); execution.getSystemContext().setStepErrorKey(ex.getMessage()); }
protected void navigate(Execution execution, ExecutionStep currStep) throws InterruptedException { Long position; try { if (currStep.getNavigation() != null) { Map<String, Object> navigationData = new HashMap<>(currStep.getNavigationData()); // We add all the contexts to the step data - so inside of each control action we will have access to all contexts addContextData(navigationData, execution); position = (Long) reflectionAdapter.executeControlAction(currStep.getNavigation(), navigationData); execution.setPosition(position); } else { execution.setPosition(null); // terminate the flow - we got to the last step! } } catch (RuntimeException navEx) { // If Exception occurs in navigation (almost impossible since now we always have Flow Exception Step) we can not continue since we don't know which step is the next step... // terminating... logger.error("Error occurred during navigation execution. Execution id: " + execution.getExecutionId(), navEx); execution.getSystemContext().setStepErrorKey(navEx.getMessage()); // this is done only fo reporting execution.getSystemContext().setFlowTerminationType(ExecutionStatus.SYSTEM_FAILURE); execution.setPosition(null); // this ends the flow!!! try { createErrorEvent(navEx.getMessage(), "Error occurred during navigation execution ", EventConstants.SCORE_STEP_NAV_ERROR, execution.getSystemContext()); } catch (RuntimeException eventEx) { logger.error("Failed to create event: ", eventEx); } } }
} catch (TimeoutException timeout) { logger.error("Timed out waiting for cancel for execution id " + execution.getExecutionId()); execution.getSystemContext().setStepErrorKey(timeoutMessage); } catch (Exception ex) { logger.error("Error during execution: ", ex); execution.getSystemContext().setStepErrorKey(ex.getMessage()); // this is done only fo reporting execution.getSystemContext().setFlowTerminationType(ExecutionStatus.SYSTEM_FAILURE);