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
commitf5f6460b2eab9d8cdd1de3231a5770bedd7e34f9 (patch)
tree0eff02506e6364d1dcb5c71b2edaacd6662ffe20 /util/async.lua
parent1454ac8208cfb734d1ae90dd89c442b6be9f9598 (diff)
downloadprosody-f5f6460b2eab9d8cdd1de3231a5770bedd7e34f9.tar.gz
prosody-f5f6460b2eab9d8cdd1de3231a5770bedd7e34f9.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;