Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_isErrorRetryable (error) {
// Retry Network Errors.
if (axiosRetry.isNetworkError(error)) {
return true
}
if (!error.response) {
// Cannot determine if the request can be retried
return false
}
// Retry Server Errors (5xx).
if (error.response.status >= 500 && error.response.status <= 599) {
return true
}
// Retry if rate limited.
if (error.response.status === 429) {
return true
export const isNetworkErrorOrRouterTimeout = (e: any) => {
if (isNetworkError(e)) {
console.warn('Retry from network error', e.message)
return true
}
if (e && e.response && e.response.data && e.response.data.code === TIMEOUT_CODE) {
console.warn('Retry from timeout', e.message)
return true
}
return false
}
const shouldRetry = error => {
return axiosRetry.isNetworkError(error) ||
axiosRetry.isRetryableError(error) ||
error.code === 'ECONNABORTED' ||
(error.response && error.response.status === 429);
};
const retryConfig = {