diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-09 11:42:45 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-09 18:09:50 +0100 |
commit | 391a4b92c977cd64dfd131f3e29b0bc8d756d064 (patch) | |
tree | b5b96ff935853cef9ee22e01890c248a791e724e /openpgp/src/policy.rs | |
parent | 58d662c6d37dd1b0dccd4d0ce30290b8ede408e9 (diff) |
Switch from failure to anyhow.
- Use the anyhow crate instead of failure to implement the dynamic
side of our error handling. anyhow::Error derefs to dyn
std::error::Error, allowing better interoperability with other
stdlib-based error handling libraries.
- Fixes #444.
Diffstat (limited to 'openpgp/src/policy.rs')
-rw-r--r-- | openpgp/src/policy.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs index 7e16273c..16e01102 100644 --- a/openpgp/src/policy.rs +++ b/openpgp/src/policy.rs @@ -29,7 +29,7 @@ use std::fmt; use std::time::{SystemTime, Duration}; use std::u32; -use failure::ResultExt; +use anyhow::Context; use crate::{ cert::prelude::*, @@ -983,7 +983,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { - DirectKey => Err(format_err!("direct key!")), + DirectKey => Err(anyhow::anyhow!("direct key!")), _ => Ok(()), } } @@ -1000,7 +1000,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { - SubkeyBinding => Err(format_err!("subkey signature!")), + SubkeyBinding => Err(anyhow::anyhow!("subkey signature!")), _ => Ok(()), } } @@ -1037,7 +1037,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { PositiveCertification => - Err(format_err!("positive certification!")), + Err(anyhow::anyhow!("positive certification!")), _ => Ok(()), } } @@ -1074,7 +1074,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { CertificationRevocation => - Err(format_err!("certification certification!")), + Err(anyhow::anyhow!("certification certification!")), _ => Ok(()), } } @@ -1108,7 +1108,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { SubkeyRevocation => - Err(format_err!("subkey revocation!")), + Err(anyhow::anyhow!("subkey revocation!")), _ => Ok(()), } } @@ -1188,7 +1188,7 @@ mod test { eprintln!("{:?}", sig.typ()); match sig.typ() { Binary => - Err(format_err!("binary!")), + Err(anyhow::anyhow!("binary!")), _ => Ok(()), } } @@ -1203,7 +1203,7 @@ mod test { use crate::types::SignatureType::*; match sig.typ() { - SubkeyBinding => Err(format_err!("subkey signature!")), + SubkeyBinding => Err(anyhow::anyhow!("subkey signature!")), _ => Ok(()), } } @@ -1478,7 +1478,7 @@ mod test { eprintln!("algo: {}", ka.key().pk_algo()); if ka.key().pk_algo() == RSAEncryptSign { - Err(format_err!("RSA!")) + Err(anyhow::anyhow!("RSA!")) } else { Ok(()) } @@ -1581,7 +1581,7 @@ mod test { eprintln!("algo: {} is {}", ka.fingerprint(), ka.key().pk_algo()); if ka.key().pk_algo() == RSAEncryptSign { - Err(format_err!("RSA!")) + Err(anyhow::anyhow!("RSA!")) } else { Ok(()) } |