diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-06-16 10:52:13 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-06-16 11:03:51 +0200 |
commit | 30a91a5713e5492b7060f4d237fad4c6340ca2ab (patch) | |
tree | 099f560bb9c5ef7888ef5229305c4024eb38e171 /ffi/src/error.rs | |
parent | 64e30bfaab82e4349b50e0f1673d6a3912ababb0 (diff) |
openpgp: Consolidate the two failure::Error definition
- Rename NoKeyFound to MalformedTPK.
- Drop NoUserId, which is not used.
- Rename node::Error::MalformedKey to MalformedTPK.
Diffstat (limited to 'ffi/src/error.rs')
-rw-r--r-- | ffi/src/error.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ffi/src/error.rs b/ffi/src/error.rs index e47abd74..a8ad8d55 100644 --- a/ffi/src/error.rs +++ b/ffi/src/error.rs @@ -94,11 +94,10 @@ pub enum Status { /// Invalid session key. InvalidSessionKey = -12, - /// Key not found. - KeyNotFound = -13, + /// Malformed TPK. + MalformedTPK = -13, - /// User ID not found. - UserIDNotFound = -14, + // XXX: -14 was UserIDNotFound. // XXX: Skipping InvalidArgument = -15. @@ -164,15 +163,8 @@ impl<'a> From<&'a failure::Error> for Status { Status::BadSignature, &openpgp::Error::MalformedMessage(_) => Status::MalformedMessage, - } - } - - if let Some(e) = e.downcast_ref::<openpgp::tpk::Error>() { - return match e { - &openpgp::tpk::Error::NoKeyFound => - Status::KeyNotFound, - &openpgp::tpk::Error::NoUserId => - Status::UserIDNotFound, + &openpgp::Error::MalformedTPK(_) => + Status::MalformedTPK, } } |