1use rocket::response::{self, Responder};
2use rocket::Request;
3
4pub type Result<T, E = AnyhowError> = std::result::Result<T, E>;
6
7#[derive(Debug)]
10pub struct AnyhowError(pub anyhow::Error);
11
12impl<E> From<E> for AnyhowError
13where
14 E: Into<anyhow::Error>,
15{
16 fn from(error: E) -> Self {
17 AnyhowError(error.into())
18 }
19}
20
21impl<'r> Responder<'r, 'static> for AnyhowError {
22 fn respond_to(self, request: &Request<'_>) -> response::Result<'static> {
23 response::Debug(self.0).respond_to(request)
24 }
25}