Software /
code /
prosody
Changeset
2977:686f9a5a7f5e
modulemanager: Log proper tracebacks on errors during module load/unload.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 19 Apr 2010 18:29:10 +0500 |
parents | 2976:15c056c1d9eb |
children | 2978:5760074dc7d4 |
files | core/modulemanager.lua |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/modulemanager.lua Mon Apr 19 18:28:12 2010 +0500 +++ b/core/modulemanager.lua Mon Apr 19 18:29:10 2010 +0500 @@ -19,7 +19,7 @@ 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 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"};