class WorkflowActionBBFailure {

    protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
        try {
            String requestId = (String) execution.getVariable("mso-request-id");
            InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
            String errorMsg = "";
            Optional<String> errorMsgOp = retrieveErrorMessage(execution);
            if (errorMsgOp.isPresent()) {
                errorMsg = errorMsgOp.get();
            } else {
                errorMsg = "Failed to determine error message";
            }
            Boolean isRollback = (Boolean) execution.getVariable("isRollback");
            if (!Boolean.TRUE.equals(isRollback)) {
                request.setStatusMessage(errorMsg);
            } else {
                request.setRollbackStatusMessage(errorMsg);
            }
            request.setProgress(Long.valueOf(100));
            request.setLastModifiedBy("CamundaBPMN");
            request.setEndTime(new Timestamp(System.currentTimeMillis()));
            requestDbclient.updateInfraActiveRequests(request);
        } catch (Exception e) {
            logger.error(
                    "Failed to update Request db with the status message after retry or rollback has been initialized.",
                    e);
        }
    }

}