#[derive(Debug)]
pub enum HttpResponseError {
IoError(std::io::Error),
MissingHeader(String),
_Other(&'static str),
}
impl From<std::io::Error> for HttpResponseError {
fn from(err: std::io::Error) -> Self {
HttpResponseError::IoError(err)
}
}
impl std::error::Error for HttpResponseError {}
impl std::fmt::Display for HttpResponseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
HttpResponseError::IoError(e) => write!(f, "IO error: {}", e),
HttpResponseError::_Other(e) => write!(f, "Error: {}", e),
HttpResponseError::MissingHeader(h) => write!(f, "Missing header: {}", h),
}
}
}