2023-07-01 20:34:21 +02:00
|
|
|
use axum::http::StatusCode;
|
|
|
|
|
use axum::response::{IntoResponse, Response};
|
|
|
|
|
|
|
|
|
|
pub type Result<T> = core::result::Result<T, Error>;
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum Error {
|
|
|
|
|
LoginFail,
|
2023-10-05 14:33:12 +02:00
|
|
|
PropertyDeleteFailIdNotFound { id: u64 },
|
2023-07-01 20:34:21 +02:00
|
|
|
}
|
|
|
|
|
|
2023-10-05 14:33:12 +02:00
|
|
|
/// FIXME: return different status codes for different errors
|
2023-07-01 20:34:21 +02:00
|
|
|
impl IntoResponse for Error {
|
|
|
|
|
fn into_response(self) -> Response {
|
|
|
|
|
println!("->> {:<12} - {self:?}", "INTO_RESPONSE");
|
|
|
|
|
|
|
|
|
|
(StatusCode::INTERNAL_SERVER_ERROR, "UNHANDLED_CLIENT_ERROR").into_response()
|
|
|
|
|
}
|
|
|
|
|
}
|