# HG changeset patch # User Matthew Wild # Date 1606163931 0 # Node ID 75636bf13bf03c024a34446ab0a46f3d3afe374c # Parent 9d1e21c23784d716c01365ea9bf7b9bb3af16ca0 util.promise: Use xpcall() for promise function to preserve tracebacks diff -r 9d1e21c23784 -r 75636bf13bf0 util/promise.lua --- a/util/promise.lua Wed Nov 11 16:00:41 2020 +0100 +++ b/util/promise.lua Mon Nov 23 20:38:51 2020 +0000 @@ -78,7 +78,7 @@ 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