mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
use proper Result instead of Option for encryption and decryption
This commit is contained in:
committed by
holger krekel
parent
cee0e22ce7
commit
8667de994e
@@ -24,6 +24,8 @@ pub enum Error {
|
||||
Utf8(std::str::Utf8Error),
|
||||
#[fail(display = "{:?}", _0)]
|
||||
CStringError(crate::dc_tools::CStringError),
|
||||
#[fail(display = "PGP: {:?}", _0)]
|
||||
Pgp(pgp::errors::Error),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
@@ -70,6 +72,12 @@ impl From<crate::dc_tools::CStringError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<pgp::errors::Error> for Error {
|
||||
fn from(err: pgp::errors::Error) -> Error {
|
||||
Error::Pgp(err)
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! bail {
|
||||
($e:expr) => {
|
||||
|
||||
Reference in New Issue
Block a user