| 32 | impl ApiError { |
| 33 | #[must_use] |
| 34 | pub fn is_retryable(&self) -> bool { |
| 35 | match self { |
| 36 | Self::Http(error) => error.is_connect() || error.is_timeout() || error.is_request(), |
| 37 | Self::Api { retryable, .. } => *retryable, |
| 38 | Self::RetriesExhausted { last_error, .. } => last_error.is_retryable(), |
| 39 | Self::MissingApiKey |
| 40 | | Self::ExpiredOAuthToken |
| 41 | | Self::Auth(_) |
| 42 | | Self::InvalidApiKeyEnv(_) |
| 43 | | Self::Io(_) |
| 44 | | Self::Json(_) |
| 45 | | Self::InvalidSseFrame(_) |
| 46 | | Self::BackoffOverflow { .. } => false, |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | impl Display for ApiError { |