aboutsummaryrefslogtreecommitdiffstats
path: root/util/async.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-10-26 19:32:00 +0100
committerMatthew Wild <mwild1@gmail.com>2018-10-26 19:32:00 +0100
commit9b5c6c4d9de2d32a3a0391e6d06a178f21dbb807 (patch)
tree0eff02506e6364d1dcb5c71b2edaacd6662ffe20 /util/async.lua
parent3bc2c02797799a0e71c4a04dc810d2d683271c42 (diff)
downloadprosody-9b5c6c4d9de2d32a3a0391e6d06a178f21dbb807.tar.gz
prosody-9b5c6c4d9de2d32a3a0391e6d06a178f21dbb807.zip
Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall
Diffstat (limited to 'util/async.lua')
-rw-r--r--util/async.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/async.lua b/util/async.lua
index 4d9f159f..20397785 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -1,6 +1,7 @@
local logger = require "util.logger";
local log = logger.init("util.async");
local new_id = require "util.id".short;
+local xpcall = require "util.xpcall".xpcall;
local function checkthread()
local thread, main = coroutine.running();
@@ -27,7 +28,7 @@ local function call_watcher(runner, watcher_name, ...)
return false;
end
runner:log("debug", "Calling '%s' watcher", watcher_name);
- local ok, err = pcall(watcher, runner, ...); -- COMPAT: Switch to xpcall after Lua 5.1
+ local ok, err = xpcall(watcher, debug.traceback, runner, ...);
if not ok then
runner:log("error", "Error in '%s' watcher: %s", watcher_name, err);
return nil, err;