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 /core | |
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 'core')
-rw-r--r-- | core/Cargo.toml | 2 | ||||
-rw-r--r-- | core/src/lib.rs | 6 |
2 files changed, 3 insertions, 5 deletions
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. |