Skip to content

Commit

Permalink
Add properties to error after retry.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Dec 6, 2023
1 parent da022d1 commit a485c95
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async function retryExecutor(func) {
const result = await func();
return result;
} catch (error) {
error.retryCount = iteration;
lastError = error;
if (isNetworkError(error) || error.message === 'Network Error' || error.code === 'ERR_NETWORK' || !error.status || error.status >= 500) {
lastError.isNetworkError = true;
await new Promise(resolve => setTimeout(resolve, 10 * 2 ** iteration));
continue;
}
Expand Down

0 comments on commit a485c95

Please sign in to comment.