#[derive(Error, Debug)]
pub enum SerializationError {
#[error("{}", _0)]
AnyhowError(#[from] anyhow::Error),
#[error(transparent)]
BincodeError(#[from] bincode::Error),
#[error(transparent)]
IntError(#[from] std::num::TryFromIntError),
#[error("the input buffer contained invalid data")]
InvalidData,
#[error("IoError: {0}")]
IoError(#[from] crate::io::Error),
#[error("the last byte does not have enough space to encode the extra info bits")]
NotEnoughSpace,
#[error("the call expects empty flags")]
UnexpectedFlags,
#[error("the value was serialized on a target that is incompatible with the current target")]
IncompatibleTarget,
}
impl From<SerializationError> for crate::io::Error {
fn from(error: SerializationError) -> Self {
crate::io::Error::new(crate::io::ErrorKind::Other, format!("{error}"))
}
}