feat: add some extra retry functions
Add some extra retry functions commit-id:7b1d5b99
This commit is contained in:
parent
99cb1c6216
commit
56cef0dff7
1 changed files with 10 additions and 0 deletions
10
lib/http.util.ts
Normal file
10
lib/http.util.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import type { AxiosError } from 'axios';
|
||||
import { isNetworkOrIdempotentRequestError } from 'axios-retry';
|
||||
|
||||
export function isGatewayError(error: AxiosError): boolean {
|
||||
return !!error.response && error.response.status >= 502 && error.response.status <= 504;
|
||||
}
|
||||
|
||||
export function isNetworkOrIdempotentRequestOrGatewayError(error: AxiosError): boolean {
|
||||
return isNetworkOrIdempotentRequestError(error) || isGatewayError(error);
|
||||
}
|
Loading…
Reference in a new issue