diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-11-21 21:14:40 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-11-21 21:14:40 +0100 |
commit | 48c2945172b88c35c187d298a35bf26716af4e91 (patch) | |
tree | 2af21ddb4dcacd191e07fef156609b7c1488ebaf /src/error.rs | |
parent | 6ed535387df0dffa72a10e601b8ea37c99345d84 (diff) |
Switch to varlink as IPC protocol
This is a lot! Whole new design on top of a statefult varlink interface.
You can now handle multiple request response cycles over a single
connection.
The error responses are lot more refined than just status codes with
optional messages and finally part of the protocol.
TODO: A lot of error handling needs to be improved.
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) - } -} |