pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("i/o error: {0}")]
Io(#[from] std::io::Error),
#[error("malformed input: {0}")]
Malformed(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("invalid configuration: {0}")]
Config(String),
}
impl Error {
pub fn malformed(msg: impl Into<String>) -> Self {
Error::Malformed(msg.into())
}
pub fn unsupported(msg: impl Into<String>) -> Self {
Error::Unsupported(msg.into())
}
}