You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Above fn is a slightly simplified version of one from my codebase
When the wormholescan API was down the other day this was throwing an uncaught exception after calling wh.getVaa and crashing the entire app. Chased it down with the debugger a little bit by modifying the url in node_modules to throw a similar exception.
Appears that something about the retry function is causing this error to happen outside the scope of this try.catch block. If I modify this in the tasks file to have a catch block (as below) it begins to be handled.
export async function retry(task, interval, timeout = DEFAULT_TASK_TIMEOUT, title) {
const maxRetries = Math.floor(timeout / interval);
let retries = 0;
return new Promise((resolve, reject) => {
task().then((result) => {
if (result !== null) {
resolve(result);
return;
}
let intervalId = setInterval(async () => {
if (retries >= maxRetries) {
clearInterval(intervalId);
resolve(null);
return;
}
const result = await task();
if (result !== null) {
clearInterval(intervalId);
resolve(result);
}
else if (title) {
console.log(`Retrying ${title}, attempt ${retries}/${maxRetries} `);
}
retries++;
}, interval);
}).catch((e) => {
reject(e)
});
});
}
The text was updated successfully, but these errors were encountered:
orion-wilson
changed the title
GetVAA throws outside of try/catch block.
getVAAWithRetries throws outside of try/catch block.
Jan 14, 2025
Above fn is a slightly simplified version of one from my codebase
When the wormholescan API was down the other day this was throwing an uncaught exception after calling
wh.getVaa
and crashing the entire app. Chased it down with the debugger a little bit by modifying the url in node_modules to throw a similar exception.Appears that something about the retry function is causing this error to happen outside the scope of this try.catch block. If I modify this in the
tasks
file to have a catch block (as below) it begins to be handled.The text was updated successfully, but these errors were encountered: