function drush_notify_shutdown_error

8.0.x notify.drush.inc drush_notify_shutdown_error()
6.x notify.drush.inc drush_notify_shutdown_error()
7.x notify.drush.inc drush_notify_shutdown_error()

Shutdown function to signal on errors.

1 string reference to 'drush_notify_shutdown_error'
notify.drush.inc in commands/core/notify.drush.inc
Add system notifications as a new drush option.

File

commands/core/notify.drush.inc, line 60
Add system notifications as a new drush option.

Code

function drush_notify_shutdown_error() {
  if (drush_get_option('notify', FALSE) && drush_get_error()) {
    // If the only error is that notify failed, do not try to notify again.
    $log = drush_get_error_log();
    if (count($log) == 1 && array_key_exists('NOTIFY_COMMAND_NOT_FOUND', $log)) {
      return;
    }

    // Send an alert that the command failed.
    $cmd = drush_get_command();
    if (drush_notify_allowed($cmd['command'])) {
      $msg = dt("Command '!command' failed.", array('!command' => $cmd['command']));
      drush_notify_send(drush_notify_command_message($cmd['command'] . ':error', $msg));
    }
  }
}