replace failure (which is deprecated) with thiserror (#105) (#106)

This commit is contained in:
Adam Cigánek 2020-12-16 10:47:40 +01:00 committed by GitHub
parent 7709462f2d
commit a7fbfa4522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -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"

View File

@ -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,
}