diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-11-23 20:38:51 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-11-23 20:38:51 +0000 |
commit | ab2d0056a576bed08c65c00afe495858e3f1a446 (patch) | |
tree | 8f85328770526fa5eba8a5c1f43ce769cefba458 /util | |
parent | 8a0198f4be5976852e12b6e622882ef3854cbf1f (diff) | |
download | prosody-ab2d0056a576bed08c65c00afe495858e3f1a446.tar.gz prosody-ab2d0056a576bed08c65c00afe495858e3f1a446.zip |
util.promise: Use xpcall() for promise function to preserve tracebacks
Diffstat (limited to 'util')
-rw-r--r-- | util/promise.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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 |