| 43 | |
| 44 | #[derive(Debug, thiserror::Error)] |
| 45 | pub enum ProviderError { |
| 46 | #[error("API error (status {status_code}): {message}")] |
| 47 | ApiErrorWithStatus { message: String, status_code: u16 }, |
| 48 | |
| 49 | #[error("API error: {0}")] |
| 50 | ApiError(String), |
| 51 | |
| 52 | #[error("Network error: {0}")] |
| 53 | NetworkError(String), |
| 54 | |
| 55 | #[error("Authentication error: {0}")] |
| 56 | AuthError(String), |
| 57 | |
| 58 | #[error("Rate limit exceeded")] |
| 59 | RateLimit, |
| 60 | |
| 61 | #[error("Model not found: {0}")] |
| 62 | ModelNotFound(String), |
| 63 | |
| 64 | #[error("Invalid request: {0}")] |
| 65 | InvalidRequest(String), |
| 66 | |
| 67 | #[error("Stream error: {0}")] |
| 68 | StreamError(String), |
| 69 | |
| 70 | #[error("Timeout")] |
| 71 | Timeout, |
| 72 | |
| 73 | #[error("Provider not found: {0}")] |
| 74 | ProviderNotFound(String), |
| 75 | |
| 76 | #[error("Configuration error: {0}")] |
| 77 | ConfigError(String), |
| 78 | |
| 79 | #[error("Context overflow: {0}")] |
| 80 | ContextOverflow(String), |
| 81 | } |
| 82 | |
| 83 | impl crate::retry::IsRetryable for ProviderError { |
| 84 | fn is_retryable(&self) -> Option<String> { |
no outgoing calls
no test coverage detected