xitca_web/error/
extension.rs1use core::{any::type_name, fmt};
2
3use std::error;
4
5use super::{error_from_service, forward_blank_internal};
6
7#[derive(Debug)]
11pub struct ExtensionNotFound(&'static str);
12
13impl ExtensionNotFound {
14 pub(crate) fn from_type<T>() -> Self {
15 Self(type_name::<T>())
16 }
17}
18
19impl fmt::Display for ExtensionNotFound {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 write!(f, "{} type can't be found from Extensions", self.0)
22 }
23}
24
25impl error::Error for ExtensionNotFound {}
26
27error_from_service!(ExtensionNotFound);
28forward_blank_internal!(ExtensionNotFound);