Merge pull request #229 from furality/spr/main/7b1d5b99

feat: add some extra retry functions
This commit is contained in:
ttshivers 2023-12-23 18:33:02 -06:00 committed by GitHub
commit 3fa1c8f9b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

10
lib/http.util.ts Normal file
View 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);
}