core/moduleapi.lua
changeset 9559 e4c09e335bd9
parent 9512 b57353f76c83
child 9690 e52e4e6e7ffb
--- a/core/moduleapi.lua	Thu Oct 25 21:59:17 2018 +0200
+++ b/core/moduleapi.lua	Thu Oct 25 17:11:10 2018 +0200
@@ -129,6 +129,9 @@
 
 function api:depends(name)
 	local modulemanager = require"core.modulemanager";
+	if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
+		error("Dependency on disabled module mod_"..name);
+	end
 	if not self.dependencies then
 		self.dependencies = {};
 		self:hook("module-reloaded", function (event)
@@ -145,9 +148,6 @@
 			end
 		end);
 	end
-	if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
-		self:log("warn", "Loading prerequisite mod_%s despite it being disabled", name);
-	end
 	local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name);
 	if mod and mod.module.host == "*" and self.host ~= "*"
 	and modulemanager.module_has_method(mod, "add_host") then