Software /
code /
prosody
Diff
net/connlisteners.lua @ 4220:05f4db0459b1
net.connlisteners: Log traceback on errors in listener loading.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 02 Mar 2011 05:11:42 +0500 |
parent | 3540:bc139431830b |
child | 4322:aff627b1ce95 |
line wrap: on
line diff
--- a/net/connlisteners.lua Tue Mar 01 06:12:43 2011 +0000 +++ b/net/connlisteners.lua Wed Mar 02 05:11:42 2011 +0500 @@ -13,8 +13,10 @@ 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 @@ 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;