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/types/timestamp.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/types/timestamp.rs')
-rw-r--r-- | openpgp/src/types/timestamp.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs index b86d08ef..5d5c3198 100644 --- a/openpgp/src/types/timestamp.rs +++ b/openpgp/src/types/timestamp.rs @@ -26,7 +26,7 @@ impl From<u32> for Timestamp { } impl TryFrom<SystemTime> for Timestamp { - type Error = failure::Error; + type Error = anyhow::Error; fn try_from(t: SystemTime) -> Result<Self> { match t.duration_since(std::time::UNIX_EPOCH) { @@ -131,14 +131,14 @@ impl Timestamp { /// /// First, get the certification key. /// let mut keypair = /// alice.keys().with_policy(policy, t).secret().for_certification() - /// .nth(0).ok_or_else(|| failure::err_msg("no valid key at"))? + /// .nth(0).ok_or_else(|| anyhow::anyhow!("no valid key at"))? /// .key().clone().into_keypair()?; /// /// // Then, lookup the binding between `bob@example.org` and /// // `bob` at `t`. /// let ca = bob.userids().with_policy(policy, t) /// .filter(|ca| ca.userid().value() == b"bob@example.org") - /// .nth(0).ok_or_else(|| failure::err_msg("no valid userid"))?; + /// .nth(0).ok_or_else(|| anyhow::anyhow!("no valid userid"))?; /// /// // Finally, Alice certifies the binding between /// // `bob@example.org` and `bob` at `t`. @@ -193,7 +193,7 @@ impl From<u32> for Duration { } impl TryFrom<SystemDuration> for Duration { - type Error = failure::Error; + type Error = anyhow::Error; fn try_from(d: SystemDuration) -> Result<Self> { if d.as_secs() <= std::u32::MAX as u64 { |