class ActivitiRuntimeHelper {

    public void setTaskErrorInWorkflow(DelegateExecution execution, String errorMessage, Exception exception)
    {
        setTaskWorkflowVariable(execution, VARIABLE_STATUS, TASK_STATUS_ERROR);
        setTaskWorkflowVariable(execution, VARIABLE_ERROR_MESSAGE, errorMessage);
        if (exception != null)
        {
            LOGGER.warn("Workflow encountered an error. Logging stack trace in case it is needed to debug an issue. " +
                "activitiCurrentActivityId=\"{}\" activitiExecutionId=\"{}\"", execution.getCurrentActivityId(), execution.getId(), exception);
            // TODO: Remove this logging statement above and set a workflow variable with the stack trace instead.
            // setTaskWorkflowVariable(execution, "taskErrorStackTrace", ExceptionUtils.getStackTrace(exception));
        }
    }

}