function BaseBoot::report_command_error

8.0.x BaseBoot.php BaseBoot::report_command_error($command)
7.x BaseBoot.php BaseBoot::report_command_error($command)
master BaseBoot.php BaseBoot::report_command_error($command)

Called by Drush if a command is not found, or if the command was found, but did not meet requirements.

The implementation in BaseBoot should be sufficient for most cases, so this method typically will not need to be overridden.

Overrides Boot::report_command_error

2 calls to BaseBoot::report_command_error()
BaseBoot::bootstrap_and_dispatch in lib/Drush/Boot/BaseBoot.php
Main entrypoint to bootstrap the selected CMS and execute the selected command.
DrupalBoot::report_command_error in lib/Drush/Boot/DrupalBoot.php
Called by Drush if a command is not found, or if the command was found, but did not meet requirements.
1 method overrides BaseBoot::report_command_error()
DrupalBoot::report_command_error in lib/Drush/Boot/DrupalBoot.php
Called by Drush if a command is not found, or if the command was found, but did not meet requirements.

File

lib/Drush/Boot/BaseBoot.php, line 27

Namespace

Drush\Boot

Class

BaseBoot

Code

function report_command_error($command) {
  // Set errors related to this command.
  $args = implode(' ', drush_get_arguments());
  if (isset($command) && is_array($command)) {
    foreach ($command['bootstrap_errors'] as $key => $error) {
      drush_set_error($key, $error);
    }
    drush_set_error('DRUSH_COMMAND_NOT_EXECUTABLE', dt("The drush command '!args' could not be executed.", array('!args' => $args)));
  }
  elseif (!empty($args)) {
    drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt("The drush command '!args' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.", array('!args' => $args)));
  }
  // Set errors that occurred in the bootstrap phases.
  $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
  foreach ($errors as $code => $message) {
    drush_set_error($code, $message);
  }
}