nestjs-http-promise/lib/http.util.ts
Conicaw 56cef0dff7
feat: add some extra retry functions
Add some extra retry functions

commit-id:7b1d5b99
2023-12-23 18:31:58 -06:00

10 lines
429 B
TypeScript

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);
}