#[doc(hidden)]
extern crate alloc;
use crate::ConstString;
#[non_exhaustive]
pub enum Error {
SubtreeNotFound {
index: usize,
},
InvalidRequestType {
value: u8,
},
RecursionLimit {
behavior: ConstString,
},
}
impl core::error::Error for Error {
}
impl core::fmt::Debug for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::SubtreeNotFound { index } => write!(f, "IndexNotFound({index})"),
Self::InvalidRequestType { value } => write!(f, "InvalidRequestType({value})"),
Self::RecursionLimit { behavior } => write!(f, "RecursionLimit({behavior})"),
}
}
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::SubtreeNotFound { index } => write!(f, "the subtree with the index {index} cannot be found"),
Self::InvalidRequestType { value } => write!(f, "an invalid request type {value} was sent from Groot2"),
Self::RecursionLimit { behavior } => write!(f, "recursion limit of '127' is reached for behavior {behavior}"),
}
}
}