mirror of
https://github.com/LeNei/axum-sqlx-template.git
synced 2026-02-13 22:56:19 +00:00
24 lines
504 B
Rust
24 lines
504 B
Rust
pub mod user;
|
|
|
|
use axum::response::{IntoResponse, Redirect, Response};
|
|
use tokio::task;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum InertiaError {
|
|
#[error(transparent)]
|
|
Sqlx(#[from] sqlx::Error),
|
|
|
|
#[error(transparent)]
|
|
TaskJoin(#[from] task::JoinError),
|
|
|
|
#[error("Something went wrong")]
|
|
Unknown,
|
|
}
|
|
|
|
impl IntoResponse for InertiaError {
|
|
fn into_response(self) -> Response {
|
|
tracing::error!("Error: {:?}", self);
|
|
Redirect::to("/error").into_response()
|
|
}
|
|
}
|