promise-retry: debug retry errors

This commit is contained in:
Girish Ramakrishnan
2021-12-07 11:14:24 -08:00
parent b4ed05c911
commit ae0e572593
2 changed files with 3 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ async function promiseRetry(options, asyncFunction) {
return await asyncFunction();
} catch (error) {
if (i === times - 1) throw error;
if (options.debug) options.debug(`Attempt ${i+1} failed. Will retry: ${error.message}`);
await delay(interval);
}
}