aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modulemanager.lua5
-rw-r--r--main.lua4
2 files changed, 6 insertions, 3 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 3e1dfa30..aadd89de 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -68,7 +68,7 @@ function load(name)
local mod, err = loadfile("plugins/mod_"..name..".lua");
if not mod then
log("error", "Unable to load module '%s': %s", name or "nil", err or "nil");
- return;
+ return nil, err;
end
local pluginenv = setmetatable({ module = { name = name } }, { __index = modulehelpers });
@@ -77,8 +77,9 @@ function load(name)
local success, ret = pcall(mod);
if not success then
log("error", "Error initialising module '%s': %s", name or "nil", ret or "nil");
- return;
+ return nil, err;
end
+ return true;
end
function handle_stanza(origin, stanza)
diff --git a/main.lua b/main.lua
index eac26fe5..2dd1a1d9 100644
--- a/main.lua
+++ b/main.lua
@@ -41,7 +41,9 @@ require "util.jid"
-- Initialise modules
if config.modules and #config.modules > 0 then
for _, module in pairs(config.modules) do
- modulemanager.load(module);
+ if not modulemanager.load(module) then
+ error("Unable to load module "..module);
+ end
end
else error("No modules enabled in the configuration file"); end