From a6b266940bf510bd6b61d9b58a3619c0f976f247 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tim.dijen@minbzk.nl>
Date: Wed, 27 Jan 2021 12:11:37 +0100
Subject: [PATCH] Improved exception messages

---
 lib/SimpleSAML/Module.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php
index fa8e55072..ef6222319 100644
--- a/lib/SimpleSAML/Module.php
+++ b/lib/SimpleSAML/Module.php
@@ -422,6 +422,12 @@ class Module
             if (!class_exists($className)) {
                 throw new \Exception("Could not resolve '$id': no class named '$className'.");
             }
+        } elseif (!in_array($tmp[0], self::getModules())) {
+            // Module not installed
+            throw new \Exception('No module named \'' . $tmp[0]. '\' has been installed.');
+        } elseif (!self::isModuleEnabled($tmp[0])) {
+            // Module installed, but not enabled
+            throw new \Exception('The module \'' . $tmp[0]. '\' is not enabled.');
         } else {
             // should be a module
             // make sure empty types are handled correctly
-- 
GitLab