Tue, 13 Jan 2009 23:16:39 +0500
modulemanager: Check for syntax errors before reloading a module
core/modulemanager.lua | file | annotate | diff | comparison | revisions |
--- a/core/modulemanager.lua Tue Jan 13 22:39:07 2009 +0500 +++ b/core/modulemanager.lua Tue Jan 13 23:16:39 2009 +0500 @@ -164,6 +164,12 @@ 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)