(&self)
| 82 | |
| 83 | impl crate::retry::IsRetryable for ProviderError { |
| 84 | fn is_retryable(&self) -> Option<String> { |
| 85 | match self { |
| 86 | ProviderError::RateLimit => Some("Rate limited".to_string()), |
| 87 | ProviderError::Timeout => Some("Request timed out".to_string()), |
| 88 | ProviderError::NetworkError(msg) => Some(format!("Network error: {msg}")), |
| 89 | ProviderError::ApiErrorWithStatus { |
| 90 | status_code, |
| 91 | message, |
| 92 | } => { |
| 93 | if matches!(status_code, 429 | 500 | 502 | 503 | 504) { |
| 94 | Some(format!("API error {status_code}: {message}")) |
| 95 | } else { |
| 96 | None |
| 97 | } |
| 98 | } |
| 99 | ProviderError::ApiError(_) |
| 100 | | ProviderError::AuthError(_) |
| 101 | | ProviderError::ModelNotFound(_) |
| 102 | | ProviderError::InvalidRequest(_) |
| 103 | | ProviderError::StreamError(_) |
| 104 | | ProviderError::ProviderNotFound(_) |
| 105 | | ProviderError::ConfigError(_) |
| 106 | | ProviderError::ContextOverflow(_) => None, |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | static OVERFLOW_PATTERNS: Lazy<Vec<Regex>> = Lazy::new(|| { |
no outgoing calls
no test coverage detected