mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 22:18:00 +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,26 +16,38 @@
|
||||
|
||||
//! Initialization errors.
|
||||
|
||||
// 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 error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
|
||||
impl_extract_backtrace, impl_error_chain_kind};
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
Io(::std::io::Error) #[doc="IO error"];
|
||||
Cli(::clap::Error) #[doc="CLI error"];
|
||||
Service(::service::Error) #[doc="Substrate service error"];
|
||||
Client(client::error::Error) #[doc="Client error"];
|
||||
}
|
||||
errors {
|
||||
/// Input error.
|
||||
Input(m: String) {
|
||||
description("Invalid input"),
|
||||
display("{}", m),
|
||||
/// Result type alias for the CLI.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Error type for the CLI.
|
||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||
pub enum Error {
|
||||
/// Io error
|
||||
Io(std::io::Error),
|
||||
/// Cli error
|
||||
Cli(clap::Error),
|
||||
/// Service error
|
||||
Service(service::Error),
|
||||
/// Client error
|
||||
Client(client::error::Error),
|
||||
/// Input error
|
||||
Input(String),
|
||||
/// Invalid listen multiaddress
|
||||
#[display(fmt="Invalid listen multiaddress")]
|
||||
InvalidListenMultiaddress
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
Error::Io(ref err) => Some(err),
|
||||
Error::Cli(ref err) => Some(err),
|
||||
Error::Service(ref err) => Some(err),
|
||||
Error::Client(ref err) => Some(err),
|
||||
Error::Input(_) => None,
|
||||
Error::InvalidListenMultiaddress => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user