models_dev/error.rs
1//! Error types for the models-dev client.
2
3/// Errors that can occur when interacting with the models.dev API.
4#[derive(Debug, thiserror::Error)]
5pub enum ModelsDevError {
6 /// HTTP request failed.
7 #[error("HTTP request failed: {0}")]
8 HttpError(#[from] reqwest::Error),
9
10 /// JSON serialization/deserialization failed.
11 #[error("JSON error: {0}")]
12 JsonError(#[from] serde_json::Error),
13
14 /// API returned an error response.
15 #[error("API error: {0}")]
16 ApiError(String),
17
18 /// Network timeout.
19 #[error("Network timeout")]
20 Timeout,
21
22 /// Invalid URL.
23 #[error("Invalid URL: {0}")]
24 InvalidUrl(String),
25
26 /// Cache operation failed.
27 #[error("Cache error: {0}")]
28 CacheError(String),
29}