diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 0c0167f..0000000 --- a/src/error.rs +++ /dev/null @@ -1,47 +0,0 @@ -use maildir::MailEntryError; -use mailparse::MailParseError; -use protobuf::Error as PBError; - -pub type Result<T> = std::result::Result<T, Error>; - -#[derive(Debug)] -pub enum Error { - IoError(std::io::Error), - MailEntryError(MailEntryError), - SortOrder(String), - Setuid(String), - Protobuf(PBError), - PathError { msg: String, path: String }, -} - -impl std::fmt::Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { - write!(f, "{:?}", self) - } -} - -impl std::error::Error for Error {} - -impl From<std::io::Error> for Error { - fn from(io_err: std::io::Error) -> Self { - Error::IoError(io_err) - } -} - -impl From<MailEntryError> for Error { - fn from(me_err: MailEntryError) -> Self { - Error::MailEntryError(me_err) - } -} - -impl From<MailParseError> for Error { - fn from(mp_err: MailParseError) -> Self { - Error::MailEntryError(MailEntryError::ParseError(mp_err)) - } -} - -impl From<PBError> for Error { - fn from(pb_err: PBError) -> Self { - Error::Protobuf(pb_err) - } -} |