#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("invalid {what}: {msg}")]
Invalid {
what: &'static str,
msg: String,
},
#[error("not allowed: {0}")]
Denied(String),
}
impl Error {
pub(crate) fn invalid(what: &'static str, msg: impl Into<String>) -> Self {
Error::Invalid { what, msg: msg.into() }
}
}
pub type Result<T, E = Error> = std::result::Result<T, E>;