Move ethcore::Error to error_chain (#8386)
* WIP * Convert Ethcore error to use error_chain * Use error_chain for ImportError and BlockImportError * Fix error pattern matches for error_chain in miner * Implement explicit From for AccountsError * Fix pattern matches for ErrorKinds * Handle ethcore error_chain in light client * Explicitly define Result type to avoid shadowing * Fix remaining Error pattern matches * Fix tab space formatting * Helps if the tests compile * Fix error chain matching after merge
This commit is contained in:
committed by
Afri Schoedon
parent
2257bc8e2f
commit
14361cc7b1
@@ -27,7 +27,7 @@ use bytes::ToPretty;
|
||||
use rlp::PayloadInfo;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, Nonce, Balance, BlockChainClient, BlockId, BlockInfo, ImportBlock};
|
||||
use ethcore::error::ImportError;
|
||||
use ethcore::error::{ImportErrorKind, BlockImportErrorKind};
|
||||
use ethcore::miner::Miner;
|
||||
use ethcore::verification::queue::VerifierSettings;
|
||||
use ethcore_service::ClientService;
|
||||
@@ -257,7 +257,7 @@ fn execute_import_light(cmd: ImportBlockchain) -> Result<(), String> {
|
||||
}
|
||||
|
||||
match client.import_header(header) {
|
||||
Err(BlockImportError::Import(ImportError::AlreadyInChain)) => {
|
||||
Err(BlockImportError(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain), _)) => {
|
||||
trace!("Skipping block already in chain.");
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -428,7 +428,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
|
||||
let do_import = |bytes| {
|
||||
while client.queue_info().is_full() { sleep(Duration::from_secs(1)); }
|
||||
match client.import_block(bytes) {
|
||||
Err(BlockImportError::Import(ImportError::AlreadyInChain)) => {
|
||||
Err(BlockImportError(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain), _)) => {
|
||||
trace!("Skipping block already in chain.");
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user