aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-11-23 20:38:51 +0000
committerMatthew Wild <mwild1@gmail.com>2020-11-23 20:38:51 +0000
commitab2d0056a576bed08c65c00afe495858e3f1a446 (patch)
tree8f85328770526fa5eba8a5c1f43ce769cefba458 /util
parent8a0198f4be5976852e12b6e622882ef3854cbf1f (diff)
downloadprosody-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.lua2
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