I usually use the drush_set_error() function when I want to log a error in drush, sometimes I just do something like this:

drush_set_error('DRUSH_INVALID_ARGUMENT', '....');


drush_set_error('MODULE_NAME_INVALID_ARGUMENT', '....');

But I'm wondering if there is a standard or something similar to correctly name the error codes.

The only doc that comes in the function description is:

\Drupal\Component\Render\MarkupInterface|string $error: A text string identifying the type of error.

  • I guess "officially" there isn't. But I would follow the same good practice/convention as with D7's watchdog() and use the module name. – No Sssweat Sep 20 '17 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.