llm_edge_providers/
error.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ProviderError {
5 #[error("HTTP error: {0}")]
6 Http(#[from] reqwest::Error),
7
8 #[error("Serialization error: {0}")]
9 Serialization(#[from] serde_json::Error),
10
11 #[error("Provider API error: {status} - {message}")]
12 ApiError { status: u16, message: String },
13
14 #[error("Timeout")]
15 Timeout,
16
17 #[error("Rate limit exceeded")]
18 RateLimitExceeded,
19
20 #[error("Invalid configuration: {0}")]
21 Configuration(String),
22
23 #[error("Internal error: {0}")]
24 Internal(String),
25}
26
27pub type ProviderResult<T> = Result<T, ProviderError>;