194c44c
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ConfigError {
#[error("failed to load .env file: {0}")]
DotEnv(#[from] dotenvy::Error),
#[error("config parse/merge error: {0}")]
Figment(Box<figment::Error>),
#[error("config I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("config validation failed: {0}")]
Validation(String),
}
impl From<figment::Error> for ConfigError {
fn from(error: figment::Error) -> Self {
// Boxed because a figment error carries ~200 bytes of provenance; an
// inline variant would make every `Result<_, ConfigError>` in the
// workspace pay for it on the success path too.
Self::Figment(Box::new(error))
}
}