diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-05 16:36:00 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-09 11:52:38 +0100 |
commit | 0a64f6eaa56a9762810b282f4073db3a2fe2fe7d (patch) | |
tree | cebe1d6afbb092322f378e22d4a197e7974e2483 | |
parent | 247c0afa9af65d5ba357f77feac2229b3db5983e (diff) |
core: Define core::Error using thiserror.
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | core/Cargo.toml | 1 | ||||
-rw-r--r-- | core/src/lib.rs | 8 |
3 files changed, 6 insertions, 4 deletions
@@ -1562,6 +1562,7 @@ dependencies = [ "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)", ] [[package]] diff --git a/core/Cargo.toml b/core/Cargo.toml index 71a40247..d6a95c53 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -24,3 +24,4 @@ maintenance = { status = "actively-developed" } 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 1fda8453..aa6ba30d 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -268,16 +268,16 @@ impl Config { /// Result type for Sequoia. pub type Result<T> = ::std::result::Result<T, failure::Error>; -#[derive(Fail, Debug)] +#[derive(thiserror::Error, Debug)] /// Errors for Sequoia. pub enum Error { /// The network policy was violated by the given action. - #[fail(display = "Unmet network policy requirement: {}", _0)] + #[error("Unmet network policy requirement: {0}")] NetworkPolicyViolation(NetworkPolicy), /// An `io::Error` occurred. - #[fail(display = "{}", _0)] - IoError(#[cause] io::Error), + #[error("{0}")] + IoError(#[from] io::Error), } /* Network policy. */ |