* Checks if the error is a network-related error
(error: any)
| 34 | * Checks if the error is a network-related error |
| 35 | */ |
| 36 | function isNetworkError(error: any): boolean { |
| 37 | const networkCodes = [ |
| 38 | "ECONNRESET", |
| 39 | "ENOTFOUND", |
| 40 | "ETIMEDOUT", |
| 41 | "EPIPE", |
| 42 | "ECONNREFUSED", |
| 43 | ]; |
| 44 | return networkCodes.includes(error.code); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Checks if the HTTP status code is retryable |