Skip to content

Commit

Permalink
Merge pull request #229 from furality/spr/main/7b1d5b99
Browse files Browse the repository at this point in the history
feat: add some extra retry functions
  • Loading branch information
ttshivers authored Dec 24, 2023
2 parents 99cb1c6 + 56cef0d commit 3fa1c8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/http.util.ts
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 3fa1c8f

Please sign in to comment.