Software /
code /
prosody
Diff
util/promise.lua @ 11210:75636bf13bf0 0.11
util.promise: Use xpcall() for promise function to preserve tracebacks
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 23 Nov 2020 20:38:51 +0000 |
parent | 9562:acf74ad0b795 |
child | 11211:1151140fc757 |
line wrap: on
line diff
--- 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