Commit dd7bb28d authored by JC Brand's avatar JC Brand

Report traceback when `waitUntil` times out

parent 58d018e8
......@@ -575,6 +575,7 @@ u.waitUntil = function (func, max_wait=300, check_delay=3) {
}
const promise = u.getResolveablePromise();
const timeout_err = new Error();
function checker () {
try {
......@@ -590,12 +591,16 @@ u.waitUntil = function (func, max_wait=300, check_delay=3) {
}
const interval = setInterval(checker, check_delay);
const max_wait_timeout = setTimeout(() => {
function handler () {
clearTimers(max_wait_timeout, interval);
const err_msg = 'Wait until promise timed out';
const err_msg = `Wait until promise timed out: \n\n${timeout_err.stack}`;
console.trace();
log.error(err_msg);
promise.reject(new Error(err_msg));
}, max_wait);
}
const max_wait_timeout = setTimeout(handler, max_wait);
return promise;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment