Skip to content

Commit

Permalink
More helpful exception when missing plugin config.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Nov 8, 2023
1 parent b9baf47 commit 14fae93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/marvelapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace tool_powerusers;

use moodle_exception;
use moodle_url;
use stdClass;

/**
Expand All @@ -41,7 +42,8 @@ public static function get_users(string $name, string $type): array {
$publickey = get_config('tool_powerusers', 'marvelpublickey');

if (empty($privatekey) || empty($publickey)) {
throw new moodle_exception(get_string('errorkeys', 'tool_powerusers'));
throw new moodle_exception('errorkeys', 'tool_powerusers',
new moodle_url('/admin/settings.php', ['section' => 'tool_powerusers_settings']));
}

$name = str_replace( ' ', '%20', trim($name));
Expand Down

0 comments on commit 14fae93

Please sign in to comment.