1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum ConfigError {
6 #[error("Failed to load configuration from {path}: {message}")]
7 LoadError { path: PathBuf, message: String },
8
9 #[error("Failed to save configuration to {path}: {message}")]
10 SaveError { path: PathBuf, message: String },
11
12 #[error("Missing required API key")]
13 MissingApiKey,
14
15 #[error("Invalid configuration value: {0}")]
16 ValidationError(String),
17
18 #[error("Environment variable error: {0}")]
19 EnvVar(#[from] std::env::VarError),
20
21 #[error("IO error: {0}")]
22 Io(#[from] std::io::Error),
23
24 #[error("Config parsing error: {0}")]
25 Parse(String),
26}
27
28pub type Result<T> = std::result::Result<T, ConfigError>;