File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
packages/corejs/src/tasks Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,27 @@ const RETRY_CONFIG = {
3131 retries : MAX_RETRY_ATTEMPTS ,
3232 retryDelay : ( retryCount : number ) => axiosRetry . exponentialDelay ( retryCount ) ,
3333 // shouldResetTimeout: true,
34- retryCondition : ( error : AxiosError ) => axiosRetry . isNetworkOrIdempotentRequestError ( error ) || error ?. response ?. status === 500 ,
34+ retryCondition : ( error : AxiosError ) => {
35+ // Check if the error response is in a range of server error status codes (5xx)
36+ const hasServerError = error . response && error . response . status >= 500 && error . response . status <= 599 ;
37+
38+ // Check if the error is a CORS error
39+ const isCorsError = / c o r s / i. test ( error . message ) ;
40+
41+ // Check if the error is a network or idempotent request error
42+ const isNetworkError = axiosRetry . isNetworkOrIdempotentRequestError ( error ) ;
43+
44+ // Add a custom check for specific error messages
45+ const isCustomNetworkError = error . message && error . message === 'Network Error' ;
46+
47+ // Check for other common conditions that you might want to retry
48+ const shouldRetry = hasServerError
49+ || isCorsError
50+ || isNetworkError
51+ || isCustomNetworkError ;
52+
53+ return shouldRetry ;
54+ } ,
3555} ;
3656
3757/**
You can’t perform that action at this time.
0 commit comments