Software /
code /
prosody
Changeset
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 |
parents | 4218:8a271b3fcaa7 |
children | 4221:92594f1c7373 |
files | net/connlisteners.lua |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
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;