use alloc::string::String;
use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum RouteError {
NotFound { route: String },
Extract { message: String },
}
pub type RouteResult<T> = Result<T, RouteError>;
impl fmt::Display for RouteError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NotFound { route } => write!(f, "route not found: {route}"),
Self::Extract { message } => write!(f, "failed to extract route parameter: {message}"),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for RouteError {}