use super::structs::ErrorMessage; use rocket::{http::Status, response::status, serde::json::Json}; pub(crate) type NotFound = status::NotFound>; pub(crate) type GenericError = status::Custom>; pub(crate) fn create_status(code: Status) -> Json { Json(ErrorMessage { code, message: code.to_string() }) } pub(crate) fn generic_error(code: Status, message: String) -> GenericError { status::Custom(code, Json(ErrorMessage { code, message })) } pub(crate) fn not_found(msg: &str) -> NotFound { status::NotFound(Json(ErrorMessage { code: Status::NotFound, message: msg.to_string(), })) }