1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error("Authentication failed: {0}")]
6 AuthError(String),
7
8 #[error("Configuration error: {0}")]
9 Config(String),
10
11 #[error("API error: {0}")]
12 API(#[from] async_openai::error::OpenAIError),
13
14 #[error("No content in response")]
15 NoContent,
16
17 #[error("Serialization error: {0}")]
18 Serialization(#[from] serde_json::Error),
19
20 #[error("Environment error: {0}")]
21 Environment(#[from] std::env::VarError),
22
23 #[error("Rate limit exceeded")]
24 RateLimit,
25
26 #[error("Request timeout")]
27 Timeout,
28
29 #[error("Validation error: {0}")]
30 ValidationError(String),
31
32 #[error("Invalid configuration: {0}")]
33 InvalidConfig(String),
34
35 #[error("Capability not supported: {0}")]
36 UnsupportedCapability(String),
37
38 #[error("Model not found: {0}")]
39 ModelNotFound(String),
40
41 #[error(transparent)]
42 Other(#[from] anyhow::Error),
43}