summaryrefslogtreecommitdiffstats
path: root/openpgp/examples
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-09 11:42:45 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-03-09 18:09:50 +0100
commit391a4b92c977cd64dfd131f3e29b0bc8d756d064 (patch)
treeb5b96ff935853cef9ee22e01890c248a791e724e /openpgp/examples
parent58d662c6d37dd1b0dccd4d0ce30290b8ede408e9 (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/examples')
-rw-r--r--openpgp/examples/decrypt-with.rs1
-rw-r--r--openpgp/examples/generate-sign-verify.rs7
2 files changed, 3 insertions, 5 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs
index 4889d29b..5de69863 100644
--- a/openpgp/examples/decrypt-with.rs
+++ b/openpgp/examples/decrypt-with.rs
@@ -5,7 +5,6 @@ use std::collections::HashMap;
use std::env;
use std::io;
-extern crate failure;
extern crate sequoia_openpgp as openpgp;
use crate::openpgp::cert::prelude::*;
diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs
index 0e9ab2d1..294fd69d 100644
--- a/openpgp/examples/generate-sign-verify.rs
+++ b/openpgp/examples/generate-sign-verify.rs
@@ -2,7 +2,6 @@
use std::io::{self, Write};
-extern crate failure;
extern crate sequoia_openpgp as openpgp;
use crate::openpgp::cert::prelude::*;
use crate::openpgp::serialize::stream::*;
@@ -119,10 +118,10 @@ impl<'a> VerificationHelper for Helper<'a> {
Some(Err(e)) =>
return Err(openpgp::Error::from(e).into()),
None =>
- return Err(failure::err_msg("No signature")),
+ return Err(anyhow::anyhow!("No signature")),
}
},
- _ => return Err(failure::err_msg(
+ _ => return Err(anyhow::anyhow!(
"Unexpected message structure")),
}
}
@@ -130,7 +129,7 @@ impl<'a> VerificationHelper for Helper<'a> {
if good {
Ok(()) // Good signature.
} else {
- Err(failure::err_msg("Signature verification failed"))
+ Err(anyhow::anyhow!("Signature verification failed"))
}
}
}