1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum ConfigError {
6 #[error("Configuration file not found: {0}")]
7 FileNotFound(PathBuf),
8
9 #[error("Failed to read configuration file: {0}")]
10 ReadError(#[from] std::io::Error),
11
12 #[error("Failed to parse configuration: {0}")]
13 ParseError(#[from] toml::de::Error),
14
15 #[error("Failed to serialize configuration: {0}")]
16 SerializeError(#[from] toml::ser::Error),
17
18 #[error("Invalid configuration: {0}")]
19 ValidationError(String),
20
21 #[error("Configuration version mismatch: expected {expected}, found {found}")]
22 VersionMismatch { expected: u32, found: u32 },
23
24 #[error("Migration failed: {0}")]
25 MigrationError(String),
26
27 #[error("Invalid home directory")]
28 InvalidHomeDir,
29
30 #[error("Invalid workspace path: {0}")]
31 InvalidWorkspacePath(PathBuf),
32
33 #[error("Cyclic configuration inheritance detected")]
34 CyclicInheritance,
35
36 #[error("Invalid override key: {0}")]
37 InvalidOverrideKey(String),
38}
39
40pub type Result<T> = std::result::Result<T, ConfigError>;