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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GuyPaddock’s picture

Status: Active » Needs review

Setting to needs review.

Steven Jones’s picture

Status: Needs review » Fixed

Yup, 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!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 03abc9a on 6.x-1.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by Steven Jones:
    #1263544 by GuyPaddock, Steven Jones: Fixed 'Can only throw objects in...
  • Commit 69e82db on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by Steven Jones:
    #1263544 by GuyPaddock, Steven Jones: Fixed 'Can only throw objects in...