use std::{fmt, error};
pub enum HttpMethod {
GET,
POST,
PUT,
HEAD,
DELETE,
OTHER,
}
#[derive(Debug, Clone, PartialEq)]
pub enum SrvrlsError {
BadRequest(String),
BadRequestNoMessage(),
BadRequestWithSimpleMessage(String),
Unauthorized,
Forbidden,
NotFound,
MethodNotAllowed,
InternalServerError,
}
impl error::Error for SrvrlsError {}
impl fmt::Display for SrvrlsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SrvrlsError::BadRequestWithSimpleMessage(msg) => write!(f, "Bad Request: {}", msg),
SrvrlsError::BadRequestNoMessage() => write!(f, "Bad Request"),
SrvrlsError::BadRequest(msg) => write!(f, "Bad Request: {}", msg),
SrvrlsError::Unauthorized => write!(f, "Unauthorized"),
SrvrlsError::Forbidden => write!(f, "Forbidden"),
SrvrlsError::NotFound => write!(f, "Not Found"),
SrvrlsError::MethodNotAllowed => write!(f, "Method Not Allowed"),
SrvrlsError::InternalServerError => write!(f, "InternalServerError"),
}
}
}