mentedb_extraction/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum ExtractionError {
6 #[error("provider error: {0}")]
8 ProviderError(String),
9
10 #[error("authentication failed: {0}")]
12 AuthError(String),
13
14 #[error("model not found: {0}")]
16 ModelNotFound(String),
17
18 #[error("parse error: {0}")]
20 ParseError(String),
21
22 #[error("config error: {0}")]
24 ConfigError(String),
25
26 #[error("http error: {0}")]
28 HttpError(String),
29
30 #[error("embedding error: {0}")]
32 EmbeddingError(String),
33
34 #[error("rate limit exceeded after {attempts} attempts")]
36 RateLimitExceeded { attempts: usize },
37}
38
39impl From<reqwest::Error> for ExtractionError {
40 fn from(e: reqwest::Error) -> Self {
41 ExtractionError::HttpError(e.to_string())
42 }
43}
44
45impl From<serde_json::Error> for ExtractionError {
46 fn from(e: serde_json::Error) -> Self {
47 ExtractionError::ParseError(e.to_string())
48 }
49}