hotfix_web_ui/error.rs
1use axum::http::StatusCode;
2use axum::response::{IntoResponse, Response};
3
4#[derive(Debug, displaydoc::Display, thiserror::Error)]
5pub enum DashboardError {
6 /// General anyhow errors
7 Anyhow(#[from] anyhow::Error),
8 /// could not render the template
9 Render(#[from] askama::Error),
10}
11
12pub type DashboardResult<T> = Result<T, DashboardError>;
13
14impl IntoResponse for DashboardError {
15 fn into_response(self) -> Response {
16 (StatusCode::INTERNAL_SERVER_ERROR, self.to_string()).into_response()
17 }
18}