[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 std::fmt;
use ethcore::error::{Error as EthcoreError, ErrorKind, CallError};
use ethcore::error::{Error as EthcoreError, CallError};
use ethcore::client::BlockId;
use jsonrpc_core::{futures, Result as RpcResult, Error, ErrorCode, Value};
use rlp::DecoderError;
@@ -440,7 +440,7 @@ pub fn transaction_message(error: &TransactionError) -> String {
pub fn transaction<T: Into<EthcoreError>>(error: T) -> Error {
let error = error.into();
if let ErrorKind::Transaction(ref e) = *error.kind() {
if let EthcoreError::Transaction(ref e) = error {
Error {
code: ErrorCode::ServerError(codes::TRANSACTION_ERROR),
message: transaction_message(e),
@@ -456,9 +456,8 @@ pub fn transaction<T: Into<EthcoreError>>(error: T) -> Error {
}
pub fn decode<T: Into<EthcoreError>>(error: T) -> Error {
let error = error.into();
match *error.kind() {
ErrorKind::Decoder(ref dec_err) => rlp(dec_err.clone()),
match error.into() {
EthcoreError::Decoder(ref dec_err) => rlp(dec_err.clone()),
_ => Error {
code: ErrorCode::InternalError,
message: "decoding error".into(),