From a7fbfa4522835010b6037fb45388c7b04ee14194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Cig=C3=A1nek?= Date: Wed, 16 Dec 2020 10:47:40 +0100 Subject: [PATCH] replace failure (which is deprecated) with thiserror (#105) (#106) --- Cargo.toml | 2 +- src/error.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0124ed4..ec934ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ edition = "2018" [dependencies] byteorder = "1.3.4" -failure = "0.1.7" ff = "0.6.0" group = "0.6.0" hex_fmt = "0.3.0" @@ -29,6 +28,7 @@ pairing = "0.16.0" rand = "0.7.3" rand_chacha = "0.2.2" serde = { version = "1.0.104", features = ["derive"] } +thiserror = "1.0.22" tiny-keccak = { version = "2.0.1", features = ["sha3"] } zeroize = "1.1.0" diff --git a/src/error.rs b/src/error.rs index 13f5b71..9907ca0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,18 +1,18 @@ //! Crypto errors. -use failure::Fail; +use thiserror::Error; /// A crypto error. -#[derive(Clone, Eq, PartialEq, Debug, Fail)] +#[derive(Clone, Eq, PartialEq, Debug, Error)] pub enum Error { /// Not enough signature shares. - #[fail(display = "Not enough signature shares")] + #[error("Not enough signature shares")] NotEnoughShares, /// Signature shares contain a duplicated index. - #[fail(display = "Signature shares contain a duplicated index")] + #[error("Signature shares contain a duplicated index")] DuplicateEntry, /// The degree is too high for the coefficients to be indexed by `usize`. - #[fail(display = "The degree is too high for the coefficients to be indexed by usize.")] + #[error("The degree is too high for the coefficients to be indexed by usize.")] DegreeTooHigh, } @@ -33,10 +33,10 @@ mod tests { } /// An error reading a structure from an array of bytes. -#[derive(Clone, Eq, PartialEq, Debug, Fail)] +#[derive(Clone, Eq, PartialEq, Debug, Error)] pub enum FromBytesError { /// Invalid representation - #[fail(display = "Invalid representation.")] + #[error("Invalid representation.")] Invalid, }