aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-01-13 23:16:39 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-01-13 23:16:39 +0500
commit15cbc4d03ede8002ee850ec84784411534adda9d (patch)
tree8085ca95f04cbc843604d919d2c5e6602d7afe41 /core/modulemanager.lua
parente9f048866981c889d8ad90e1ff6a0dae780d6014 (diff)
downloadprosody-15cbc4d03ede8002ee850ec84784411534adda9d.tar.gz
prosody-15cbc4d03ede8002ee850ec84784411534adda9d.zip
modulemanager: Check for syntax errors before reloading a module
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index c1caaacc..d8914ccc 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -164,6 +164,12 @@ function reload(host, name, ...)
local mod = modulemap[host] and modulemap[host][name];
if not mod then return nil, "module-not-loaded"; end
+ local _mod, err = loadfile(plugin_dir.."mod_"..name..".lua"); -- checking for syntax errors
+ if not _mod then
+ log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+ return nil, err;
+ end
+
local saved;
if type(mod.module.save) == "function" then
local ok, err = pcall(mod.module.save)