aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-04-19 18:29:10 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-04-19 18:29:10 +0500
commitdaf1f01bda7e8a1ae3b6c6255d0cb31cc5b3b12f (patch)
tree6ae3a9720199d0f3e8e1b4c44cf512a871053554 /core/modulemanager.lua
parent5455626d0a09235b73f698a19d5a7ce9d41545be (diff)
downloadprosody-daf1f01bda7e8a1ae3b6c6255d0cb31cc5b3b12f.tar.gz
prosody-daf1f01bda7e8a1ae3b6c6255d0cb31cc5b3b12f.zip
modulemanager: Log proper tracebacks on errors during module load/unload.
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 5e9eaedd..8e62aecb 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -19,7 +19,7 @@ local pluginloader = require "util.pluginloader";
local hosts = hosts;
local prosody = prosody;
-local loadfile, pcall = loadfile, pcall;
+local loadfile, pcall, xpcall = loadfile, pcall, xpcall;
local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv;
local pairs, ipairs = pairs, ipairs;
local t_insert, t_concat = table.insert, table.concat;
@@ -29,6 +29,14 @@ local rawget = rawget;
local error = error;
local tostring, tonumber = tostring, tonumber;
+local debug_traceback = debug.traceback;
+local unpack, select = unpack, select;
+pcall = function(f, ...)
+ local n = select("#", ...);
+ local params = {...};
+ return xpcall(function() f(unpack(params, 1, n)) end, function(e) return tostring(e).."\n"..debug_traceback(); end);
+end
+
local array, set = require "util.array", require "util.set";
local autoload_modules = {"presence", "message", "iq"};