Skip to content

Commit

Permalink
Show a friendlier message on init error (#294)
Browse files Browse the repository at this point in the history
* Show a friendlier message on init error d7a443c

When creating the member extension object in the frontend it needs to
know which section it needs to use as the member info source.

Right now, if the configured value is wrong, you get a weird message
about PHP type checking.

This commit adds a friendlier message when the configuration is not
valid.

* Remove redundant construct 21b320a

Using isset together with !empty is a redundant construct

* Capitalize and pluralize `Members` df4b18c
  • Loading branch information
nitriques authored Sep 26, 2017
1 parent ed1ce51 commit 32d12d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ public function __construct() {
else if(isset($members_section_id) && in_array((int)$members_section_id, $config_sections)) {
$this->setMembersSection($members_section_id);
}
else {
else if (!empty($config_sections[0])) {
$this->setMembersSection($config_sections[0]);
}
else {
throw new Exception(__('No Members section found! Please check your configuration.'));
}
}

extension_Members::$initialised = true;
Expand Down

0 comments on commit 32d12d2

Please sign in to comment.