From 14fae93ef8d2409c8bcf225d6a739e6b845e2968 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 8 Nov 2023 21:03:45 +0000 Subject: [PATCH] More helpful exception when missing plugin config. --- classes/marvelapi.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/marvelapi.php b/classes/marvelapi.php index 9599b69..62cb771 100644 --- a/classes/marvelapi.php +++ b/classes/marvelapi.php @@ -17,6 +17,7 @@ namespace tool_powerusers; use moodle_exception; +use moodle_url; use stdClass; /** @@ -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));