# HG changeset patch # User Waqas Hussain # Date 1299024702 -18000 # Node ID 05f4db0459b10ddbef3cadf2376a9452e44a083d # Parent 8a271b3fcaa7d5e84352bfc43165fb7c5d27c889 net.connlisteners: Log traceback on errors in listener loading. diff -r 8a271b3fcaa7 -r 05f4db0459b1 net/connlisteners.lua --- 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;