* Checks if the error message indicates a connection issue
(errorMessage: string)
| 63 | * Checks if the error message indicates a connection issue |
| 64 | */ |
| 65 | function isConnectionError(errorMessage: string): boolean { |
| 66 | const connectionErrorPatterns = [ |
| 67 | "premature close", |
| 68 | "premature end", |
| 69 | "connection reset", |
| 70 | "socket hang up", |
| 71 | "aborted", |
| 72 | "overloaded", |
| 73 | ]; |
| 74 | |
| 75 | return connectionErrorPatterns.some((pattern) => |
| 76 | errorMessage.includes(pattern), |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Checks if the error indicates a context length issue (non-retryable) |