aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-30 17:35:07 +0200
committerKim Alvefur <zash@zash.se>2020-06-30 17:35:07 +0200
commit7acd39cdbef144ecf3f32d4237de945c188fd5be (patch)
treead951fb44f4bed495cde99e552f0892aff03900c
parent0a071df2d476cabe6153b250189ca6fa0e8a1762 (diff)
downloadprosody-7acd39cdbef144ecf3f32d4237de945c188fd5be.tar.gz
prosody-7acd39cdbef144ecf3f32d4237de945c188fd5be.zip
net.server_epoll: Allow setting a custom error handler for listener
This lets plugins handle errors in some custom way, should they wish to.
-rw-r--r--net/server_epoll.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index f102f806..5ad20371 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -192,7 +192,8 @@ function interface:on(what, ...)
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);