2026-01-23 13:56:30 +01:00
|
|
|
use askama::Template;
|
|
|
|
|
use askama_web::WebTemplate;
|
|
|
|
|
use axum::response::{IntoResponse, Response};
|
2026-01-26 01:05:10 +01:00
|
|
|
use snafu::prelude::*;
|
|
|
|
|
|
|
|
|
|
use crate::state::config::ConfigError;
|
2026-01-23 13:56:30 +01:00
|
|
|
|
|
|
|
|
#[derive(Template, WebTemplate)]
|
|
|
|
|
#[template(path = "error.html")]
|
|
|
|
|
struct ErrorTemplate {}
|
|
|
|
|
|
2026-01-26 01:05:10 +01:00
|
|
|
#[derive(Snafu, Debug)]
|
|
|
|
|
#[snafu(visibility(pub))]
|
2026-01-23 13:56:30 +01:00
|
|
|
pub enum AppStateError {
|
|
|
|
|
Error,
|
2026-01-26 01:05:10 +01:00
|
|
|
#[snafu(display("Sqlite Error"))]
|
|
|
|
|
Sqlite {
|
|
|
|
|
source: sea_orm::error::DbErr,
|
|
|
|
|
},
|
|
|
|
|
#[snafu(display("Config Error"))]
|
|
|
|
|
ConfigError {
|
|
|
|
|
source: ConfigError,
|
|
|
|
|
},
|
2026-01-23 13:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl IntoResponse for AppStateError {
|
|
|
|
|
fn into_response(self) -> Response {
|
|
|
|
|
ErrorTemplate {}.into_response()
|
|
|
|
|
}
|
|
|
|
|
}
|