use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid variable name {0:?}: must be non-empty and contain no `;` or NUL")]
InvalidVarName(String),
#[error("invalid list value {0:?}: must be non-empty and contain no `;` or NUL")]
InvalidListValue(String),
#[error("invalid value: must not contain NUL")]
InvalidValue,
#[error(transparent)]
Registry(#[from] io::Error),
}
impl From<Error> for io::Error {
fn from(err: Error) -> Self {
match err {
Error::Registry(inner) => inner,
other => io::Error::new(io::ErrorKind::InvalidInput, other),
}
}
}
pub type Result<T> = std::result::Result<T, Error>;