(error: unknown)
| 25 | * Checks if an axios error is a transient network error that should be retried |
| 26 | */ |
| 27 | export function isTransientNetworkError(error: unknown): boolean { |
| 28 | if (!axios.isAxiosError(error)) { |
| 29 | return false |
| 30 | } |
| 31 | |
| 32 | // Retry on network errors (no response received) |
| 33 | if (!error.response) { |
| 34 | return true |
| 35 | } |
| 36 | |
| 37 | // Retry on server errors (5xx) |
| 38 | if (error.response.status >= 500) { |
| 39 | return true |
| 40 | } |
| 41 | |
| 42 | // Don't retry on client errors (4xx) - they're not transient |
| 43 | return false |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Makes an axios GET request with automatic retry for transient network errors |
no outgoing calls
no test coverage detected