mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 13:25:44 +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
@@ -6,6 +6,7 @@ description = "Rhododendron Round-Based consensus-algorithm for substrate"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
derive_more = "0.14.0"
|
||||
futures = "0.1.17"
|
||||
codec = { package = "parity-codec", version = "3.2", features = ["derive"] }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives" }
|
||||
@@ -20,7 +21,6 @@ runtime_version = { package = "sr-version", path = "../../sr-version" }
|
||||
runtime_io = { package = "sr-io", path = "../../sr-io" }
|
||||
tokio = "0.1.7"
|
||||
parking_lot = "0.7.1"
|
||||
error-chain = "0.12"
|
||||
log = "0.4"
|
||||
rhododendron = { version = "0.5.0", features = ["codec"] }
|
||||
exit-future = "0.1"
|
||||
|
||||
@@ -15,45 +15,36 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Error types in the rhododendron Consensus service.
|
||||
use consensus::error::{Error as CommonError, ErrorKind as CommonErrorKind};
|
||||
use consensus::error::{Error as CommonError};
|
||||
use primitives::AuthorityId;
|
||||
use client;
|
||||
use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
|
||||
impl_extract_backtrace, impl_error_chain_kind};
|
||||
|
||||
error_chain! {
|
||||
links {
|
||||
Client(client::error::Error, client::error::ErrorKind);
|
||||
Common(CommonError, CommonErrorKind);
|
||||
}
|
||||
errors {
|
||||
NotValidator(id: AuthorityId) {
|
||||
description("Local account ID not a validator at this block."),
|
||||
display("Local account ID ({:?}) not a validator at this block.", id),
|
||||
}
|
||||
PrematureDestruction {
|
||||
description("Proposer destroyed before finishing proposing or evaluating"),
|
||||
display("Proposer destroyed before finishing proposing or evaluating"),
|
||||
}
|
||||
Timer(e: ::tokio::timer::Error) {
|
||||
description("Failed to register or resolve async timer."),
|
||||
display("Timer failed: {}", e),
|
||||
}
|
||||
Executor(e: ::futures::future::ExecuteErrorKind) {
|
||||
description("Unable to dispatch agreement future"),
|
||||
display("Unable to dispatch agreement future: {:?}", e),
|
||||
}
|
||||
}
|
||||
/// A result alias.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// A RHD error type.
|
||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||
pub enum Error {
|
||||
/// Client error.
|
||||
Client(client::error::Error),
|
||||
/// Consensus error.
|
||||
Common(CommonError),
|
||||
/// Local account ID not a validator at this block.
|
||||
#[display(fmt="Local account ID ({:?}) not a validator at this block.", _0)]
|
||||
NotValidator(AuthorityId),
|
||||
/// Proposer destroyed before finishing proposing or evaluating
|
||||
#[display(fmt="Proposer destroyed before finishing proposing or evaluating")]
|
||||
PrematureDestruction,
|
||||
/// Failed to register or resolve async timer.
|
||||
#[display(fmt="Timer failed: {}", _0)]
|
||||
Timer(tokio::timer::Error),
|
||||
/// Unable to dispatch agreement future
|
||||
#[display(fmt="Unable to dispatch agreement future: {:?}", _0)]
|
||||
Executor(futures::future::ExecuteErrorKind),
|
||||
}
|
||||
|
||||
impl From<::rhododendron::InputStreamConcluded> for Error {
|
||||
fn from(_: ::rhododendron::InputStreamConcluded) -> Self {
|
||||
CommonErrorKind::IoTerminated.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CommonErrorKind> for Error {
|
||||
fn from(e: CommonErrorKind) -> Self {
|
||||
CommonError::from(e).into()
|
||||
CommonError::IoTerminated.into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user