summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--Cargo.lock26
-rw-r--r--core/Cargo.toml2
-rw-r--r--core/src/lib.rs6
-rw-r--r--ffi-macros/src/lib.rs6
-rw-r--r--ffi/Cargo.toml2
-rw-r--r--ffi/src/error.rs5
-rw-r--r--ffi/src/lib.rs1
-rw-r--r--ffi/src/net.rs2
-rw-r--r--ffi/tests/c-tests.rs3
-rw-r--r--guide/Cargo.toml2
-rw-r--r--guide/src/chapter_01.md28
-rw-r--r--ipc/Cargo.toml2
-rw-r--r--ipc/src/assuan/mod.rs10
-rw-r--r--ipc/src/gnupg.rs20
-rw-r--r--ipc/src/lib.rs7
-rw-r--r--ipc/tests/gpg-agent.rs4
-rw-r--r--net/Cargo.toml2
-rw-r--r--net/src/lib.rs7
-rw-r--r--net/src/wkd.rs8
-rw-r--r--openpgp-ffi/Cargo.toml2
-rw-r--r--openpgp-ffi/src/armor.rs6
-rw-r--r--openpgp-ffi/src/cert.rs2
-rw-r--r--openpgp-ffi/src/common.rs6
-rw-r--r--openpgp-ffi/src/error.rs17
-rw-r--r--openpgp-ffi/src/io.rs12
-rw-r--r--openpgp-ffi/src/lib.rs1
-rw-r--r--openpgp-ffi/src/packet/pkesk.rs3
-rw-r--r--openpgp-ffi/src/packet/skesk.rs3
-rw-r--r--openpgp-ffi/src/parse/mod.rs4
-rw-r--r--openpgp-ffi/src/parse/stream.rs10
-rw-r--r--openpgp-ffi/src/serialize.rs10
-rw-r--r--openpgp-ffi/tests/c-tests.rs3
-rw-r--r--openpgp/Cargo.toml2
-rw-r--r--openpgp/examples/decrypt-with.rs1
-rw-r--r--openpgp/examples/generate-sign-verify.rs7
-rw-r--r--openpgp/src/cert/key_amalgamation.rs10
-rw-r--r--openpgp/src/cert/mod.rs6
-rw-r--r--openpgp/src/cert/parser/low_level/mod.rs2
-rw-r--r--openpgp/src/cert/parser/mod.rs4
-rw-r--r--openpgp/src/crypto/aead.rs10
-rw-r--r--openpgp/src/crypto/keygrip.rs2
-rw-r--r--openpgp/src/crypto/sexp.rs4
-rw-r--r--openpgp/src/fingerprint.rs2
-rw-r--r--openpgp/src/keyhandle.rs4
-rw-r--r--openpgp/src/keyid.rs2
-rw-r--r--openpgp/src/lib.rs5
-rw-r--r--openpgp/src/message/mod.rs8
-rw-r--r--openpgp/src/packet/header/ctb.rs2
-rw-r--r--openpgp/src/packet/key/mod.rs4
-rw-r--r--openpgp/src/packet/one_pass_sig.rs2
-rw-r--r--openpgp/src/packet/unknown.rs12
-rw-r--r--openpgp/src/packet/userid/mod.rs6
-rw-r--r--openpgp/src/packet_pile.rs2
-rw-r--r--openpgp/src/parse/parse.rs11
-rw-r--r--openpgp/src/parse/stream.rs54
-rw-r--r--openpgp/src/policy.rs20
-rw-r--r--openpgp/src/serialize/partial_body.rs5
-rw-r--r--openpgp/src/types/timestamp.rs8
-rw-r--r--openpgp/tests/for-each-artifact.rs4
-rw-r--r--sqv/Cargo.toml3
-rw-r--r--sqv/src/sqv.rs20
-rw-r--r--store/Cargo.toml2
-rw-r--r--store/src/backend/mod.rs7
-rw-r--r--store/src/lib.rs5
-rw-r--r--store/src/macros.rs12
-rw-r--r--tool/Cargo.toml2
-rw-r--r--tool/src/commands/decrypt.rs13
-rw-r--r--tool/src/commands/key.rs32
-rw-r--r--tool/src/commands/mod.rs19
-rw-r--r--tool/src/commands/sign.rs12
-rw-r--r--tool/src/sq.rs25
71 files changed, 237 insertions, 336 deletions
diff --git a/Cargo.lock b/Cargo.lock
index aaab7a5d..5d3f2643 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -22,6 +22,11 @@ dependencies = [
]
[[package]]
+name = "anyhow"
+version = "1.0.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1559,8 +1564,8 @@ dependencies = [
name = "sequoia-core"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1569,7 +1574,7 @@ dependencies = [
name = "sequoia-ffi"
version = "0.15.0"
dependencies = [
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1598,7 +1603,7 @@ dependencies = [
name = "sequoia-guide"
version = "0.15.0"
dependencies = [
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"sequoia-openpgp 0.15.0",
]
@@ -1606,9 +1611,9 @@ dependencies = [
name = "sequoia-ipc"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"capnp-rpc 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1629,7 +1634,7 @@ dependencies = [
name = "sequoia-net"
version = "0.15.0"
dependencies = [
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1652,10 +1657,10 @@ dependencies = [
name = "sequoia-openpgp"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"buffered-reader 0.14.0",
"bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1675,7 +1680,7 @@ dependencies = [
name = "sequoia-openpgp-ffi"
version = "0.15.0"
dependencies = [
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1688,11 +1693,11 @@ dependencies = [
name = "sequoia-sqv"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"colored 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"sequoia-openpgp 0.15.0",
]
@@ -1700,10 +1705,10 @@ dependencies = [
name = "sequoia-store"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"capnp 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"capnp-rpc 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"capnpc 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rusqlite 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1720,12 +1725,12 @@ dependencies = [
name = "sequoia-tool"
version = "0.15.0"
dependencies = [
+ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
"assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"colored 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossterm 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"prettytable-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rpassword 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2262,6 +2267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum aho-corasick 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d5e63fd144e18ba274ae7095c0197a870a7b9468abc801dd62f190d80817d2ec"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
+"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
"checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
"checksum ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index d6a95c53..f3f013f8 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -21,7 +21,7 @@ gitlab = { repository = "sequoia-pgp/sequoia" }
maintenance = { status = "actively-developed" }
[dependencies]
+anyhow = "1"
dirs = "2.0"
-failure = "0.1.2"
tempfile = "3.1"
thiserror = "1"
diff --git a/core/src/lib.rs b/core/src/lib.rs
index aa6ba30d..5db7e6bf 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -20,8 +20,6 @@
extern crate dirs;
extern crate tempfile;
-#[macro_use]
-extern crate failure;
use std::fmt;
use std::io;
@@ -199,7 +197,7 @@ impl Config {
if home_not_set {
c.home =
dirs::home_dir().ok_or(
- format_err!("Failed to get users home directory"))?
+ anyhow::anyhow!("Failed to get users home directory"))?
.join(".sequoia");
}
}
@@ -266,7 +264,7 @@ impl Config {
/* Error handling. */
/// Result type for Sequoia.
-pub type Result<T> = ::std::result::Result<T, failure::Error>;
+pub type Result<T> = ::std::result::Result<T, anyhow::Error>;
#[derive(thiserror::Error, Debug)]
/// Errors for Sequoia.
diff --git a/ffi-macros/src/lib.rs b/ffi-macros/src/lib.rs
index e4107c49..8b315b72 100644
--- a/ffi-macros/src/lib.rs
+++ b/ffi-macros/src/lib.rs
@@ -648,7 +648,7 @@ fn derive_conversion_functions(mut st: syn::ItemStruct,
}
impl #generics crate::MoveResultIntoRaw<Option<::std::ptr::NonNull<#wrapper #generics>>>
- for ::failure::Fallible<#wrapped>
+ for ::anyhow::Result<#wrapped>
{
fn move_into_raw(self, errp: Option<&mut *mut crate::error::Error>)