mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
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:
@@ -9,11 +9,10 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
description = "Transaction pool client facing API."
|
||||
|
||||
[dependencies]
|
||||
futures = { version = "0.3.1" }
|
||||
log = { version = "0.4.8" }
|
||||
futures = "0.3.1"
|
||||
log = "0.4.8"
|
||||
serde = { version = "1.0.132", features = ["derive"] }
|
||||
thiserror = { version = "1.0.30" }
|
||||
sp-runtime = { version = "4.1.0-dev", default-features = false, path = "../../../primitives/runtime" }
|
||||
thiserror = "1.0.30"
|
||||
|
||||
derive_more = { version = "0.99.16" }
|
||||
sp-runtime = { version = "4.1.0-dev", default-features = false, path = "../../../primitives/runtime" }
|
||||
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
|
||||
|
||||
@@ -26,7 +26,7 @@ use sp_runtime::transaction_validity::{
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Transaction pool error type.
|
||||
#[derive(Debug, thiserror::Error, derive_more::From)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Error {
|
||||
#[error("Unknown transaction validity: {0:?}")]
|
||||
@@ -64,7 +64,6 @@ pub enum Error {
|
||||
#[error("Transaction cannot be propagated and the local node does not author blocks")]
|
||||
Unactionable,
|
||||
|
||||
#[from(ignore)]
|
||||
#[error("{0}")]
|
||||
InvalidBlockId(String),
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ use std::{
|
||||
|
||||
use graph::{ExtrinsicHash, IsValidator};
|
||||
use sc_transaction_pool_api::{
|
||||
ChainEvent, ImportNotificationStream, MaintainedTransactionPool, PoolFuture, PoolStatus,
|
||||
ReadyTransactions, TransactionFor, TransactionPool, TransactionSource,
|
||||
error::Error as TxPoolError, ChainEvent, ImportNotificationStream, MaintainedTransactionPool,
|
||||
PoolFuture, PoolStatus, ReadyTransactions, TransactionFor, TransactionPool, TransactionSource,
|
||||
TransactionStatusStreamFor, TxHash,
|
||||
};
|
||||
use sp_core::traits::SpawnEssentialNamed;
|
||||
@@ -418,8 +418,8 @@ where
|
||||
.validate_transaction_blocking(at, TransactionSource::Local, xt.clone())?
|
||||
.map_err(|e| {
|
||||
Self::Error::Pool(match e {
|
||||
TransactionValidityError::Invalid(i) => i.into(),
|
||||
TransactionValidityError::Unknown(u) => u.into(),
|
||||
TransactionValidityError::Invalid(i) => TxPoolError::InvalidTransaction(i),
|
||||
TransactionValidityError::Unknown(u) => TxPoolError::UnknownTransaction(u),
|
||||
})
|
||||
})?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user