Skip to content
Snippets Groups Projects
Commit 3b20048d authored by Éloïs's avatar Éloïs
Browse files

[feat] crypto: use failure for BaseConversionError

parent 05ab8ea3
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !107. Comments created here will be created in the context of that merge request.
......@@ -16,6 +16,7 @@ path = "src/lib.rs"
base58 = "0.1.*"
base64 = "0.10.*"
bincode = "1.0.*"
failure = "0.1.5"
rand = "0.5.*"
rust-crypto-wasm = "0.3.1"
serde = "1.0.*"
......
......@@ -74,12 +74,15 @@ pub trait GetKeysAlgo: Clone + Debug + PartialEq + Eq {
}
/// Errors enumeration for Base58/64 strings convertion.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Fail)]
pub enum BaseConvertionError {
#[fail(display = "Data have invalid key length.")]
/// Data have invalid key length (found, expected).
InvalidKeyLendth(usize, usize),
#[fail(display = "Invalid character.")]
/// Base58 have an invalid character.
InvalidCharacter(char, usize),
#[fail(display = "Invalid base converter length.")]
/// Base58 have invalid lendth
InvalidBaseConverterLength(),
}
......
......@@ -29,6 +29,8 @@
)]
#![allow(non_camel_case_types)]
#[macro_use]
extern crate failure;
#[macro_use]
extern crate serde_derive;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment