use std::error::Error;
use core::fmt;
#[derive(Debug)]
pub enum ContentTypeError {
Mime(mime::FromStrError),
UnknownEncoding,
}
impl Error for ContentTypeError {}
impl fmt::Display for ContentTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
ContentTypeError::Mime(err) => write!(f, "Failed to parse Mime: {}", err),
ContentTypeError::UnknownEncoding => f.write_str("Unable to recognize encoding"),
}
}
}
impl From<mime::FromStrError> for ContentTypeError {
fn from(err: mime::FromStrError) -> Self {
ContentTypeError::Mime(err)
}
}