Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While developing a new service for Provision, I ran across the following error message:
Drush command terminated abnormally due to an unrecoverable error. [error] Error: Can only throw objects in /opt/aegir/.drush/provision/provision.config.inc, line 75
The offending code is:
function __construct($context, $data = array()) {
if (is_null($this->template)) {
throw(exception); // Line 75
}
...
I'm guessing this is supposed to be something like:
function __construct($context, $data = array()) {
if (is_null($this->template)) {
drush_set_error('PROVISION_INTERNAL_ERROR', dt("No template specified: %class", array('%class' => get_class($this))));
return;
}
...
Assuming this is the correct way to handle this issue, attached is a patch to corrects this oversight.
Comment | File | Size | Author |
---|---|---|---|
provision_config_template_exception_fix.patch | 479 bytes | GuyPaddock |
Comments
Comment #1
GuyPaddock CreditAttribution: GuyPaddock commentedSetting to needs review.
Comment #2
Steven Jones CreditAttribution: Steven Jones commentedYup, this just isn't how you throw an exception is it! I've fixed that so we actually throw it properly, using your helpful message. Thanks for the bug report though!