aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2019-03-19 09:05:15 +0000
committerMatthew Wild <mwild1@gmail.com>2019-03-19 09:05:15 +0000
commitcf15c2a1e0ddada23688ad289a5b407a334d61e1 (patch)
tree03fa135fea3a671e99314e3cd07372c094b7776d /core/modulemanager.lua
parent23577330fd9826da26a2ab0a6a3f1d6b82e5dfb8 (diff)
downloadprosody-cf15c2a1e0ddada23688ad289a5b407a334d61e1.tar.gz
prosody-cf15c2a1e0ddada23688ad289a5b407a334d61e1.zip
modulemanager: Set module status on successful or failed module load
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 17602459..0d24381a 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -169,6 +169,7 @@ local function do_load_module(host, module_name, state)
local mod, err = pluginloader.load_code(module_name, nil, pluginenv);
if not mod then
log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+ api_instance:set_status("error", "Failed to load (see log)");
return nil, err;
end
@@ -182,6 +183,7 @@ local function do_load_module(host, module_name, state)
ok, err = call_module_method(pluginenv, "load");
if not ok then
log("warn", "Error loading module '%s' on '%s': %s", module_name, host, err or "nil");
+ api_instance:set_status("warn", "Error during load (see log)");
end
end
api_instance.reloading, api_instance.saved_state = nil, nil;
@@ -204,6 +206,9 @@ local function do_load_module(host, module_name, state)
if not ok then
modulemap[api_instance.host][module_name] = nil;
log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
+ api_instance:set_status("warn", "Error during load (see log)");
+ else
+ api_instance:set_status("core", "Loaded", false);
end
return ok and pluginenv, err;
end