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 commentedSetting to needs review.
Comment #2
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!