use std::{error, fmt};
#[derive(Debug)]
#[non_exhaustive]
pub enum Warning {
EmptyNodeName,
ExtraNodeEndMarker,
IncorrectBooleanRepresentation,
InvalidFooterPaddingLength(usize, usize),
MissingNodeEndMarker,
UnexpectedFooterFieldValue,
}
impl error::Error for Warning {}
impl fmt::Display for Warning {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Warning::EmptyNodeName => write!(f, "Node name is empty"),
Warning::ExtraNodeEndMarker => write!(f, "Extra (unexpected) node end marker found"),
Warning::IncorrectBooleanRepresentation => {
write!(f, "Incorrect boolean representation")
}
Warning::InvalidFooterPaddingLength(expected, got) => write!(
f,
"Invalid footer padding length: expected {} bytes, got {} bytes",
expected, got
),
Warning::MissingNodeEndMarker => write!(f, "Missing node end marker"),
Warning::UnexpectedFooterFieldValue => write!(f, "Unexpected footer field value"),
}
}
}