Skip to main content

sdivi_config/
error.rs

1use thiserror::Error;
2
3/// Errors produced during configuration loading and validation.
4#[derive(Debug, Error)]
5pub enum ConfigError {
6    /// TOML parse failure.
7    #[error("failed to parse config: {0}")]
8    Parse(String),
9
10    /// A config value is out of range or semantically invalid.
11    #[error("invalid value for '{key}': {message}")]
12    InvalidValue { key: String, message: String },
13
14    /// A threshold override block is missing the mandatory `expires` field.
15    #[error("threshold override for '{category}' is missing the required 'expires' field")]
16    MissingExpiresOnOverride { category: String },
17
18    /// I/O error reading a config file.
19    #[error("I/O error reading config: {0}")]
20    Io(#[from] std::io::Error),
21
22    /// YAML parse failure reading `.sdivi/boundaries.yaml`.
23    #[error("failed to parse boundary spec: {0}")]
24    BoundaryParse(String),
25}