in akd/src/errors.rs [107:148]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NoDirection(node_label, child_label) => {
let mut to_print = format!("no direction provided for the node {:?}", node_label);
// Add child info if given.
if let Some(child_label) = child_label {
let child_str = format!(" and child {:?}", child_label);
to_print.push_str(&child_str);
}
write!(f, "{}", to_print)
}
Self::NoChildAtEpoch(epoch, direction) => {
write!(f, "no node in direction {} at epoch {}", direction, epoch)
}
Self::ParentNextEpochInvalid(epoch) => {
write!(f, "Next epoch of parent is invalid, epoch = {}", epoch)
}
Self::HashUpdateOrderInconsistent => {
write!(
f,
"Hash update in parent only allowed after node is inserted"
)
}
Self::NonexistentAtEpoch(label, epoch) => {
write!(
f,
"This node, labelled {:?}, did not exist at epoch {:?}.",
label, epoch
)
}
Self::NoStateAtEpoch(label, epoch) => {
write!(
f,
"This node, labelled {:?}, did not exist at epoch {:?}.",
label, epoch
)
}
Self::DigestDeserializationFailed(inner_error) => {
write!(f, "Encountered a serialization error {}", inner_error)
}
}
}