Software /
code /
prosody
Comparison
core/modulemanager.lua @ 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 |
parent | 2951:294c359a05f5 |
child | 3165:4ffb5469c1f6 |
comparison
equal
deleted
inserted
replaced
2976:15c056c1d9eb | 2977:686f9a5a7f5e |
---|---|
17 local pluginloader = require "util.pluginloader"; | 17 local pluginloader = require "util.pluginloader"; |
18 | 18 |
19 local hosts = hosts; | 19 local hosts = hosts; |
20 local prosody = prosody; | 20 local prosody = prosody; |
21 | 21 |
22 local loadfile, pcall = loadfile, pcall; | 22 local loadfile, pcall, xpcall = loadfile, pcall, xpcall; |
23 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; | 23 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; |
24 local pairs, ipairs = pairs, ipairs; | 24 local pairs, ipairs = pairs, ipairs; |
25 local t_insert, t_concat = table.insert, table.concat; | 25 local t_insert, t_concat = table.insert, table.concat; |
26 local type = type; | 26 local type = type; |
27 local next = next; | 27 local next = next; |
28 local rawget = rawget; | 28 local rawget = rawget; |
29 local error = error; | 29 local error = error; |
30 local tostring, tonumber = tostring, tonumber; | 30 local tostring, tonumber = tostring, tonumber; |
31 | |
32 local debug_traceback = debug.traceback; | |
33 local unpack, select = unpack, select; | |
34 pcall = function(f, ...) | |
35 local n = select("#", ...); | |
36 local params = {...}; | |
37 return xpcall(function() f(unpack(params, 1, n)) end, function(e) return tostring(e).."\n"..debug_traceback(); end); | |
38 end | |
31 | 39 |
32 local array, set = require "util.array", require "util.set"; | 40 local array, set = require "util.array", require "util.set"; |
33 | 41 |
34 local autoload_modules = {"presence", "message", "iq"}; | 42 local autoload_modules = {"presence", "message", "iq"}; |
35 | 43 |