Skip to content

Commit da834b8

Browse files
committed
Fix withRetry to actually catch async rejections
`return fn()` inside an async try block returns the promise directly without awaiting — rejected promises bypass the catch block entirely. Changed to `return await fn()` so async failures are caught and retried. Without this fix, withRetry never retried async callbacks (including downloadWithProgress and Netlify file uploads).
1 parent 03630e6 commit da834b8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/core/retry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function withRetry<T = void>(
2626
let attempt = 0;
2727
while (true) {
2828
try {
29-
return fn();
29+
return await fn();
3030
} catch (err) {
3131
if (!(err instanceof Error)) throw err;
3232
if ((attempt++ >= attempts) || (retry && !retry(err))) {

0 commit comments

Comments
 (0)