This repository has been archived on 2024-07-25. You can view files and clone it, but cannot push or open issues or pull requests.
enve/itconfig/src/error.rs

24 lines
604 B
Rust
Raw Normal View History

use std::error;
use std::fmt;
#[derive(Debug, PartialEq)]
pub enum EnvError {
MissingVariable(String),
FailedToParse(String),
}
impl fmt::Display for EnvError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self {
EnvError::MissingVariable(env_name) => {
write!(f, r#"Environment variable "{}" is missing"#, env_name)
}
EnvError::FailedToParse(env_name) => {
write!(f, r#"Failed to parse environment variable "{}""#, env_name)
}
}
}
}
impl error::Error for EnvError {}