From 0a64f6eaa56a9762810b282f4073db3a2fe2fe7d Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 5 Mar 2020 16:36:00 +0100 Subject: core: Define core::Error using thiserror. --- core/Cargo.toml | 1 + core/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'core') 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 = ::std::result::Result; -#[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. */ -- cgit v1.2.3