aboutsummaryrefslogtreecommitdiffstats
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
commita247cea4dfd98a09f78b5b5bcc2c832e7583b887 (patch)
tree8f85328770526fa5eba8a5c1f43ce769cefba458
parent8328e6681e7a999c59be05c9e08158a0cf9f95d0 (diff)
downloadprosody-a247cea4dfd98a09f78b5b5bcc2c832e7583b887.tar.gz
prosody-a247cea4dfd98a09f78b5b5bcc2c832e7583b887.zip
util.promise: Use xpcall() for promise function to preserve tracebacks
-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