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:
Tomasz Drwięga
2019-05-24 11:35:31 +02:00
committed by Gavin Wood
parent 69ffec5822
commit c162fc5ff1
68 changed files with 951 additions and 1158 deletions
+24 -33
View File
@@ -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()
}
}