summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-05 16:38:37 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-03-09 11:52:38 +0100
commita206235113bdb10e0d971c83f070dcf83875c47e (patch)
tree4fe55aae108580039dbacc4815f2a436375841d8 /store
parentae4ba285f16e6f59779db4cfd03e4af7374e9a18 (diff)
store: Define store::Error using thiserror.
Diffstat (limited to 'store')
-rw-r--r--store/Cargo.toml1
-rw-r--r--store/src/lib.rs25
2 files changed, 10 insertions, 16 deletions
diff --git a/store/Cargo.toml b/store/Cargo.toml
index 45e73498..d56bf09d 100644
--- a/store/Cargo.toml
+++ b/store/Cargo.toml
@@ -36,6 +36,7 @@ failure = "0.1.2"
futures = "0.1.17"
rand = { version = "0.7", default-features = false }
rusqlite = "0.19"
+thiserror = "1"
tokio-core = "0.1.10"
tokio-io = "0.1.4"
diff --git a/store/src/lib.rs b/store/src/lib.rs
index 5a1ea2d9..b6046148 100644
--- a/store/src/lib.rs
+++ b/store/src/lib.rs
@@ -53,7 +53,6 @@
extern crate capnp;
#[macro_use]
extern crate capnp_rpc;
-#[macro_use]
extern crate failure;
extern crate futures;
extern crate rand;
@@ -1180,37 +1179,31 @@ impl From<node::Error> for failure::Error {
}
}
-#[derive(Fail, Debug)]
+#[derive(thiserror::Error, Debug)]
/// Errors returned from the store.
pub enum Error {
/// A requested key was not found.
- #[fail(display = "Key not found")]
+ #[error("Key not found")]
NotFound,
/// The new key is in conflict with the current key.
- #[fail(display = "New key conflicts with the current key")]
+ #[error("New key conflicts with the current key")]
Conflict,
/// This is a catch-all for unspecified backend errors, and should
/// go away soon.
- #[fail(display = "Unspecified store error")]
+ #[error("Unspecified store error")]
StoreError,
/// A protocol error occurred.
- #[fail(display = "Unspecified protocol error")]
+ #[error("Unspecified protocol error")]
ProtocolError,
/// A Cert is malformed.
- #[fail(display = "Malformed Cert")]
+ #[error("Malformed Cert")]
MalformedCert,
/// A fingerprint is malformed.
- #[fail(display = "Malformed fingerprint")]
+ #[error("Malformed fingerprint")]
MalformedFingerprint,
/// A `capnp::Error` occurred.
- #[fail(display = "Internal RPC error")]
- RpcError(capnp::Error),
-}
-
-impl From<capnp::Error> for Error {
- fn from(error: capnp::Error) -> Self {
- Error::RpcError(error)
- }
+ #[error("Internal RPC error")]
+ RpcError(#[from] capnp::Error),
}
impl From<capnp::NotInSchema> for Error {