Diff

util/async.lua @ 9562:acf74ad0b795

Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall
author Matthew Wild <mwild1@gmail.com>
date Fri, 26 Oct 2018 19:32:00 +0100
parent 9177:83e7ad5818d3
child 10291:7b48b620164c
line wrap: on
line diff
--- a/util/async.lua	Fri Oct 26 19:29:08 2018 +0100
+++ b/util/async.lua	Fri Oct 26 19:32:00 2018 +0100
@@ -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 @@
 		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;