(message: string)
| 116 | * classifies as a timeout rather than a bare connection error. |
| 117 | */ |
| 118 | export function classifyBaseApiError(message: string): ChatProviderError { |
| 119 | if (TIMEOUT_RE.test(message)) { |
| 120 | return new APITimeoutError(message); |
| 121 | } |
| 122 | if (NETWORK_RE.test(message)) { |
| 123 | return new APIConnectionError(message); |
| 124 | } |
| 125 | return new ChatProviderError(`Error: ${message}`); |
| 126 | } |
| 127 | |
| 128 | const CONTEXT_OVERFLOW_MESSAGE_PATTERNS = [ |
| 129 | /context[ _-]?length/, |
no outgoing calls
no test coverage detected