use thiserror instead of derive_more for error handling (#10696)

* use thiserror instead of derive_more for error handling

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Update utils/prometheus/src/lib.rs

* Update utils/prometheus/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Qinxuan Chen
2022-01-26 03:48:46 +08:00
committed by GitHub
parent 38d94d6323
commit e956c2e1c7
47 changed files with 378 additions and 357 deletions
+5 -5
View File
@@ -14,13 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
async-trait = "0.1.50"
derive_more = "0.99.16"
futures = "0.3.1"
parking_lot = { version = "0.11.2", default-features = false }
serde = { version = "1.0", optional = true }
thiserror = "1.0"
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
futures = { version = "0.3.1" }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false }
merlin = { version = "2.0", default-features = false }
parking_lot = { version = "0.11.2", default-features = false }
serde = { version = "1.0", optional = true}
sp-core = { version = "4.1.0-dev", path = "../core" }
sp-externalities = { version = "0.10.0", path = "../externalities", default-features = false }
@@ -28,7 +29,6 @@ sp-externalities = { version = "0.10.0", path = "../externalities", default-feat
rand = "0.7.2"
rand_chacha = "0.2.2"
[features]
default = ["std"]
std = [
+5 -5
View File
@@ -29,19 +29,19 @@ use sp_core::{
use std::sync::Arc;
/// CryptoStore error
#[derive(Debug, derive_more::Display)]
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Public key type is not supported
#[display(fmt = "Key not supported: {:?}", _0)]
#[error("Key not supported: {0:?}")]
KeyNotSupported(KeyTypeId),
/// Validation error
#[display(fmt = "Validation error: {}", _0)]
#[error("Validation error: {0}")]
ValidationError(String),
/// Keystore unavailable
#[display(fmt = "Keystore unavailable")]
#[error("Keystore unavailable")]
Unavailable,
/// Programming errors
#[display(fmt = "An unknown keystore error occurred: {}", _0)]
#[error("An unknown keystore error occurred: {0}")]
Other(String),
}