use thiserror::Error;
#[derive(Debug, Error)]
pub enum ExtractionError {
#[error("provider error: {0}")]
ProviderError(String),
#[error("authentication failed: {0}")]
AuthError(String),
#[error("model not found: {0}")]
ModelNotFound(String),
#[error("parse error: {0}")]
ParseError(String),
#[error("config error: {0}")]
ConfigError(String),
#[error("http error: {0}")]
HttpError(String),
#[error("embedding error: {0}")]
EmbeddingError(String),
#[error("rate limit exceeded after {attempts} attempts")]
RateLimitExceeded { attempts: usize },
}
impl From<reqwest::Error> for ExtractionError {
fn from(e: reqwest::Error) -> Self {
ExtractionError::HttpError(e.to_string())
}
}
impl From<serde_json::Error> for ExtractionError {
fn from(e: serde_json::Error) -> Self {
ExtractionError::ParseError(e.to_string())
}
}