Changeset

10586:f86ed818a7f8

net.server_epoll: Collect full traceback from errors in listeners
author Kim Alvefur <zash@zash.se>
date Sun, 05 Jan 2020 02:29:31 +0100
parents 10585:2d8535338099
children 10587:863aa36a9dd8
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sat Jan 04 14:05:10 2020 +0100
+++ b/net/server_epoll.lua	Sun Jan 05 02:29:31 2020 +0100
@@ -13,6 +13,7 @@
 local type = type;
 local next = next;
 local pairs = pairs;
+local traceback = debug.traceback;
 local logger = require "util.logger";
 local log = logger.init("server_epoll");
 local socket = require "socket";
@@ -25,6 +26,7 @@
 local inet_pton = inet.pton;
 local _SOCKETINVALID = socket._SOCKETINVALID or -1;
 local new_id = require "util.id".medium;
+local xpcall = require "util.xpcall".xpcall;
 
 local poller = require "util.poll"
 local EEXIST = poller.EEXIST;
@@ -175,7 +177,7 @@
 		-- self:debug("Missing listener 'on%s'", what); -- uncomment for development and debugging
 		return;
 	end
-	local ok, err = pcall(listener, self, ...);
+	local ok, err = xpcall(listener, traceback, self, ...);
 	if not ok then
 		if cfg.fatal_errors then
 			self:debug("Closing due to error calling on%s: %s", what, err);