use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct InvalidKeyError {
key: String,
}
impl InvalidKeyError {
pub(crate) fn new(key: &str) -> Self {
Self {
key: key.to_string(),
}
}
#[must_use]
pub fn key(&self) -> &str {
&self.key
}
}
impl fmt::Display for InvalidKeyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "invalid environment variable name: {:?}", self.key)
}
}
impl std::error::Error for InvalidKeyError {}
#[cfg(test)]
#[path = "error.test.rs"]
mod tests;