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
commit15a1cfbde626b4d8fd416e28a6827899b5bf6763 (patch)
tree8f85328770526fa5eba8a5c1f43ce769cefba458 /util
parent54da54d9ed2a80438cb363dd4fb7ec60dd642b08 (diff)
downloadprosody-15a1cfbde626b4d8fd416e28a6827899b5bf6763.tar.gz
prosody-15a1cfbde626b4d8fd416e28a6827899b5bf6763.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