Changeset

10991:aa85cb5b859f

net.server_epoll: Allow setting a custom error handler for listener This lets plugins handle errors in some custom way, should they wish to.
author Kim Alvefur <zash@zash.se>
date Tue, 30 Jun 2020 17:35:07 +0200
parents 10990:03e76ad725b2
children 10992:df3ee12acd8c
files net/server_epoll.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Tue Jun 30 17:34:39 2020 +0200
+++ b/net/server_epoll.lua	Tue Jun 30 17:35:07 2020 +0200
@@ -192,7 +192,8 @@
 		self:noise("Missing listener 'on%s'", what); -- uncomment for development and debugging
 		return;
 	end
-	local ok, err = xpcall(listener, traceback, self, ...);
+	local onerror = self.listeners.onerror or traceback;
+	local ok, err = xpcall(listener, onerror, self, ...);
 	if not ok then
 		if cfg.fatal_errors then
 			self:error("Closing due to error calling on%s: %s", what, err);