aboutsummaryrefslogtreecommitdiffstats
path: root/net/connlisteners.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2011-03-02 05:11:42 +0500
committerWaqas Hussain <waqas20@gmail.com>2011-03-02 05:11:42 +0500
commit299c4a710315b2517ce4bf31fad9f012fcf8b51a (patch)
treed05f165381aa1216cde66302742f086a5b0162bb /net/connlisteners.lua
parent9cf13e5dcd6844be8be5260caa855743c4d94227 (diff)
downloadprosody-299c4a710315b2517ce4bf31fad9f012fcf8b51a.tar.gz
prosody-299c4a710315b2517ce4bf31fad9f012fcf8b51a.zip
net.connlisteners: Log traceback on errors in listener loading.
Diffstat (limited to 'net/connlisteners.lua')
-rw-r--r--net/connlisteners.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/connlisteners.lua b/net/connlisteners.lua
index e13f85de..7da25c62 100644
--- a/net/connlisteners.lua
+++ b/net/connlisteners.lua
@@ -13,8 +13,10 @@ local server = require "net.server";
local log = require "util.logger".init("connlisteners");
local tostring = tostring;
-local dofile, pcall, error =
- dofile, pcall, error
+local dofile, xpcall, error =
+ dofile, xpcall, error
+
+local debug_traceback = debug.traceback;
module "connlisteners"
@@ -37,7 +39,7 @@ end
function get(name)
local h = listeners[name];
if not h then
- local ok, ret = pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua");
+ local ok, ret = xpcall(function() dofile(listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua") end, debug_traceback);
if not ok then
log("error", "Error while loading listener '%s': %s", tostring(name), tostring(ret));
return nil, ret;