diff options
author | Kim Alvefur <zash@zash.se> | 2020-06-30 17:35:07 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-06-30 17:35:07 +0200 |
commit | cca6ca589f9ac470e704e979b252839a3b121869 (patch) | |
tree | ad951fb44f4bed495cde99e552f0892aff03900c | |
parent | d8d6efa3ab002ee94341de79d0946f218f6fb61e (diff) | |
download | prosody-cca6ca589f9ac470e704e979b252839a3b121869.tar.gz prosody-cca6ca589f9ac470e704e979b252839a3b121869.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.lua | 3 |
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); |