code: public static void alertUserOnFirstError(final ExecutableFlow flow,
        final AlerterHolder alerterHolder) {
      final ExecutionOptions options = flow.getExecutionOptions();
      if (options.getNotifyOnFirstFailure()) {
        logger.info("Alert on first error of execution " + flow.getExecutionId());
        final Alerter mailAlerter = alerterHolder.get("email");
        try {
          mailAlerter.alertOnFirstError(flow);
        } catch (final Exception e) {
          logger.error("Failed to send first error email." + e.getMessage(), e);
        }
  
        if (options.getFlowParameters().containsKey("alert.type")) {
          final String alertType = options.getFlowParameters().get("alert.type");
          final Alerter alerter = alerterHolder.get(alertType);
          if (alerter != null) {
            try {
              alerter.alertOnFirstError(flow);
            } catch (final Exception e) {
              logger.error("Failed to alert by " + alertType, e);
            }
          } else {
            logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
          }
        }
      }
    }
docs: Alert the user when the flow has encountered the first error.
  
  @param flow the execution
  @param alerterHolder the alerter holder