Problem/Motivation

While trying to write a feature, there is a check to ensure something has been selected to be exported.
In the case where nothing has been selected, the following failure is generated:

$this->failure($return, $package, NULL, t('No configuration was selected to be exported.'));

The problem is that the failure() method awaits for an Exception object an get NULL. I thought it was OK but it seems that it's not.

Proposed resolution

Two solutions available:

  1. Pass an Exception to the failure() method
    $this->failure($return, $package, new \Exception(t('No configuration was selected to be exported.')));
    
  2. Add NULL as the default value for the $exception parameter of the failure() method:
    protected function failure(array &$return, Package $package, \Exception $exception = NULL, $message = '') {
    

Remaining tasks

Choose the prefered solution
Patch
Review
Commit

User interface changes

No

API changes

No

Data model changes

No

Comments

DuaelFr created an issue. See original summary.

sourabh.singhal’s picture

Assigned: Unassigned » sourabh.singhal
sourabh.singhal’s picture

Assigned: sourabh.singhal » Unassigned
Status: Active » Needs review
StatusFileSize
new2.18 KB

Hi DuaelFr,

I have made the changes proposed in the solution and uploaded the patch. Please review.

Thanks
Sourdrup

  • mpotter committed 14d66f6 on 8.x-3.x authored by sourdrup
    Issue #2701571 by sourdrup: Argument 3 passed to Drupal\features\Plugin\...
mpotter’s picture

Status: Needs review » Fixed

Committed to 14d66f6.

Status: Fixed » Closed (fixed)

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