mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Expunge error-chain (feat. tomaka) (#2662)
* Remove error_chain * Expunge error-chain from rpc and service. * Expunge from transaction pool. * Expunge from node/cli * Expunge from keystore. * Remove some boilerplate. * Fix remaining stuff. * Improve on deprecation message. * Fix issues. * Fix trnsaction pool tests. * Fix the rest. * Fix borked merge. * Update lock
This commit is contained in:
committed by
Gavin Wood
parent
69ffec5822
commit
c162fc5ff1
@@ -16,29 +16,34 @@
|
||||
|
||||
//! Transaction pool error.
|
||||
|
||||
// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting`
|
||||
// https://github.com/paritytech/substrate/issues/1547
|
||||
#![allow(deprecated)]
|
||||
|
||||
use client;
|
||||
use txpool;
|
||||
use error_chain::{
|
||||
error_chain, error_chain_processing, impl_error_chain_processed, impl_extract_backtrace, impl_error_chain_kind
|
||||
};
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
Client(client::error::Error) #[doc = "Client error"];
|
||||
}
|
||||
links {
|
||||
Pool(txpool::error::Error, txpool::error::ErrorKind) #[doc = "Pool error"];
|
||||
/// Transaction pool result.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Transaction pool error type.
|
||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||
pub enum Error {
|
||||
/// Client error.
|
||||
Client(client::error::Error),
|
||||
/// Pool error.
|
||||
Pool(txpool::error::Error),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
Error::Client(ref err) => Some(err),
|
||||
Error::Pool(ref err) => Some(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl txpool::IntoPoolError for Error {
|
||||
fn into_pool_error(self) -> ::std::result::Result<txpool::error::Error, Self> {
|
||||
fn into_pool_error(self) -> std::result::Result<txpool::error::Error, Self> {
|
||||
match self {
|
||||
Error(ErrorKind::Pool(e), c) => Ok(txpool::error::Error(e, c)),
|
||||
Error::Pool(e) => Ok(e),
|
||||
e => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user