Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/http/axios-client-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ axiosRetry(axiosClient, {
const delay = axiosRetry.exponentialDelay(retryCount, error, 1000);
const delayInSeconds = Math.round(delay / 1000);

// Handle network errors (no response) vs HTTP errors
const errorDescription = error.response?.status
? `${error.response.status} error`
: 'network (no response) error';

console.warn(
`Retrying ${error.config?.method} request to ${error.config?.url} in ${delayInSeconds}s due to ${error.response?.status} error.`
`Retrying ${error.config?.method} request to ${error.config?.url} in ${delayInSeconds}s due to ${errorDescription}.`
);

return delay;
Expand All @@ -57,6 +62,14 @@ axiosRetry(axiosClient, {
return true;
}

// Network errors for idempotent requests if not 429, because 429 is handled above
else if (
axiosRetry.isNetworkOrIdempotentRequestError(error) &&
error.response?.status !== 429
) {
return true;
}

// all other errors
else {
return false;
Expand Down