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
-1
View File
@@ -8,7 +8,6 @@ repository = "https://github.com/paritytech/substrate"
description = "RPC for the BEEFY Client gadget for substrate"
[dependencies]
derive_more = "0.99"
futures = "0.3.16"
log = "0.4"
parking_lot = "0.11"
+4 -4
View File
@@ -36,15 +36,15 @@ mod notification;
type FutureResult<T> = jsonrpc_core::BoxFuture<Result<T, jsonrpc_core::Error>>;
#[derive(Debug, derive_more::Display, derive_more::From, thiserror::Error)]
#[derive(Debug, thiserror::Error)]
/// Top-level error type for the RPC handler
pub enum Error {
/// The BEEFY RPC endpoint is not ready.
#[display(fmt = "BEEFY RPC endpoint not ready")]
#[error("BEEFY RPC endpoint not ready")]
EndpointNotReady,
/// The BEEFY RPC background task failed to spawn.
#[display(fmt = "BEEFY RPC background task failed to spawn")]
RpcTaskFailure(SpawnError),
#[error("BEEFY RPC background task failed to spawn")]
RpcTaskFailure(#[from] SpawnError),
}
/// The error codes returned by jsonrpc.