As drush is moving towards string-based errors instead of bitmaps, we should probably ditch the bitmaps:
includes/drush.inc:define('DRUSH_NOT_COMPLETED', 0);
includes/drush.inc:define('DRUSH_SUCCESS', 1);
includes/drush.inc:define('DRUSH_COMMAND_NOT_FOUND', 2);
includes/drush.inc:define('DRUSH_DRUPAL_BOOTSTRAP_ERROR', 4);
includes/drush.inc:define('DRUSH_DRUPAL_DB_ERROR', 8);
includes/drush.inc:define('DRUSH_PERM_ERROR', 16);
includes/drush.inc:define('DRUSH_FRAMEWORK_ERROR', 32);
The bitmasks are bad because they would be a hard to implement in views. Plus they are not extensible enough, and we've had to use string-based errors anyways, so having both is confusing and error-prones, the bitmasks becoming essentially meaningless.
The bitmaps (or constants, rather) have the nice advantage of being parsed and validated by PHP, whereas string-based errors are harder to catch.
The bitmaps were useful when output parsing was still flaky, but json is much more solid so this is mostly irrelevant now. They were originally thought of as an optimisation, but actually, they do not provide any kind of performance enhancement in the database.
This is the result of a IRC conversation between me and Adrian.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drush_error_strings.diff | 12.98 KB | adrian |
Comments
Comment #1
adrian commentedHere's a patch. I will commit it with a tiny bit more verification.
This _drastically_ simplifies the error handling code.
Comment #2
adrian commentedcommitted.