mailparsing/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use thiserror::Error;

#[derive(Error, Debug, Clone, PartialEq)]
pub enum MailParsingError {
    #[error("invalid header: {0}")]
    HeaderParse(String),
    #[error("Header {0} not found in mime part")]
    MissingHeader(String),
    #[error("Unknown Mime-Version: {0}")]
    UnknownMimeVersion(String),
    #[error("Invalid Content-Transfer-Encoding: {0}")]
    InvalidContentTransferEncoding(String),
    #[error("parsing body: {0}")]
    BodyParse(String),
    #[error("Unexpected MimePart structure during write_message: {0}")]
    WriteMessageWtf(&'static str),
    #[error("IO error during write_message")]
    WriteMessageIOError,
    #[error("Error building message: {0}")]
    BuildError(&'static str),
    #[error("Error parsing Date header: {0}")]
    ChronoError(chrono::format::ParseError),
    #[error("Mime Tree has too many child parts")]
    TooManyParts,
}