Merge pull request #229 from furality/spr/main/7b1d5b99
feat: add some extra retry functions
This commit is contained in:
commit
3fa1c8f9b1
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