jonas_jones-api/src/error_responses.rs
Jonas_Jones 83ba68a8b7 Implemented new Error handling system
New Error Handling System with custom errors and JSON Error responses
2023-12-15 03:30:43 +01:00

28 lines
612 B
Rust

use serde::Serialize;
#[derive(Serialize)]
pub struct ErrorMessage {
pub(crate) code: u16,
pub(crate) message: String,
}
#[derive(Debug)]
pub struct InternalServerError;
impl warp::reject::Reject for InternalServerError {}
#[derive(Debug)]
pub struct BadRequestError;
impl warp::reject::Reject for BadRequestError {}
#[derive(Debug)]
pub struct NotFoundError;
impl warp::reject::Reject for NotFoundError {}
#[derive(Debug)]
pub struct UnauthorizedError;
impl warp::reject::Reject for UnauthorizedError {}
#[derive(Debug)]
pub struct ForbiddenError;
impl warp::reject::Reject for ForbiddenError {}