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