[ethcore] remove error_chain (#10616)

* Derive Display for BlockError

* Convert error_chain errors

* Convert ethcore usages of errors

* Fix remaining compile errors in ethcore

* Fix other crates

* Fix tests compilation

* Implement error for Snapshot error

* Remove redundant into
This commit is contained in:
Andrew Jones
2019-05-06 14:06:20 +01:00
committed by Andronik Ordian
parent b30b54e446
commit 98b89c8e4f
23 changed files with 265 additions and 241 deletions

View File

@@ -18,7 +18,7 @@ use api::WARP_SYNC_PROTOCOL_ID;
use block_sync::{BlockDownloaderImportError as DownloaderImportError, DownloadAction};
use bytes::Bytes;
use enum_primitive::FromPrimitive;
use ethcore::error::{Error as EthcoreError, ErrorKind as EthcoreErrorKind, ImportErrorKind, BlockError};
use ethcore::error::{Error as EthcoreError, ImportError, BlockError};
use ethcore::snapshot::{ManifestData, RestorationStatus};
use ethcore::verification::queue::kind::blocks::Unverified;
use ethereum_types::{H256, U256};
@@ -183,10 +183,10 @@ impl SyncHandler {
return Err(DownloaderImportError::Invalid);
}
match io.chain().import_block(block) {
Err(EthcoreError(EthcoreErrorKind::Import(ImportErrorKind::AlreadyInChain), _)) => {
Err(EthcoreError::Import(ImportError::AlreadyInChain)) => {
trace!(target: "sync", "New block already in chain {:?}", hash);
},
Err(EthcoreError(EthcoreErrorKind::Import(ImportErrorKind::AlreadyQueued), _)) => {
Err(EthcoreError::Import(ImportError::AlreadyQueued)) => {
trace!(target: "sync", "New block already queued {:?}", hash);
},
Ok(_) => {
@@ -195,7 +195,7 @@ impl SyncHandler {
sync.new_blocks.mark_as_known(&hash, number);
trace!(target: "sync", "New block queued {:?} ({})", hash, number);
},
Err(EthcoreError(EthcoreErrorKind::Block(BlockError::UnknownParent(p)), _)) => {
Err(EthcoreError::Block(BlockError::UnknownParent(p))) => {
unknown = true;
trace!(target: "sync", "New block with unknown parent ({:?}) {:?}", p, hash);
},