( lowerMessage string, provider string, statusCode int, structured providerErrorDetails, )
| 339 | } |
| 340 | |
| 341 | func streamIncompleteClassification( |
| 342 | lowerMessage string, |
| 343 | provider string, |
| 344 | statusCode int, |
| 345 | structured providerErrorDetails, |
| 346 | ) (ClassifiedError, bool) { |
| 347 | for _, match := range streamIncompleteMatches { |
| 348 | if !strings.Contains(lowerMessage, match.pattern) { |
| 349 | continue |
| 350 | } |
| 351 | if provider == "" { |
| 352 | provider = match.provider |
| 353 | } |
| 354 | return normalizeClassification(ClassifiedError{ |
| 355 | Message: streamIncompleteMessage(provider), |
| 356 | Detail: structured.detail, |
| 357 | Kind: codersdk.ChatErrorKindTimeout, |
| 358 | Provider: provider, |
| 359 | Retryable: true, |
| 360 | StatusCode: statusCode, |
| 361 | RetryAfter: structured.retryAfter, |
| 362 | }), true |
| 363 | } |
| 364 | return ClassifiedError{}, false |
| 365 | } |
| 366 | |
| 367 | func streamIncompleteMessage(provider string) string { |
| 368 | return providerSubject(provider) + " stream closed unexpectedly before the response completed." |
no test coverage detected