From ab2d0056a576bed08c65c00afe495858e3f1a446 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 23 Nov 2020 20:38:51 +0000 Subject: util.promise: Use xpcall() for promise function to preserve tracebacks --- util/promise.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/promise.lua b/util/promise.lua index 07c9c4dc..75c8697b 100644 --- a/util/promise.lua +++ b/util/promise.lua @@ -78,7 +78,7 @@ local function new(f) local p = setmetatable({ _state = "pending", _next = next_pending, _pending_on_fulfilled = {}, _pending_on_rejected = {} }, promise_mt); if f then local resolve, reject = new_resolve_functions(p); - local ok, ret = pcall(f, resolve, reject); + local ok, ret = xpcall(f, debug.traceback, resolve, reject); if not ok and p._state == "pending" then reject(ret); end -- cgit v1.2.3