From 10f42a2b390281b7bed225486b21cdd1aab6195e Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 31 Jul 2018 11:55:18 +0200 Subject: [PATCH] removed client error (#9253) --- ethcore/src/client/client.rs | 3 +- ethcore/src/client/error.rs | 55 ------------------------------------ ethcore/src/client/mod.rs | 2 -- ethcore/src/error.rs | 16 ----------- 4 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 ethcore/src/client/error.rs diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index a68c1e495..f63615701 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -34,7 +34,6 @@ use ethereum_types::{H256, Address, U256}; use block::{IsBlock, LockedBlock, Drain, ClosedBlock, OpenBlock, enact_verified, SealedBlock}; use blockchain::{BlockChain, BlockChainDB, BlockProvider, TreeRoute, ImportRoute, TransactionAddress, ExtrasInsert}; use client::ancient_import::AncientVerifier; -use client::Error as ClientError; use client::{ Nonce, Balance, ChainInfo, BlockInfo, CallContract, TransactionInfo, RegistryInfo, ReopenBlock, PrepareOpenBlock, ScheduleInfo, ImportSealedBlock, @@ -933,7 +932,7 @@ impl Client { } // prune ancient states until below the memory limit or only the minimum amount remain. - fn prune_ancient(&self, mut state_db: StateDB, chain: &BlockChain) -> Result<(), ClientError> { + fn prune_ancient(&self, mut state_db: StateDB, chain: &BlockChain) -> Result<(), ::error::Error> { let number = match state_db.journal_db().latest_era() { Some(n) => n, None => return Ok(()), diff --git a/ethcore/src/client/error.rs b/ethcore/src/client/error.rs deleted file mode 100644 index 6851a4057..000000000 --- a/ethcore/src/client/error.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015-2018 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -use std::fmt::{Display, Formatter, Error as FmtError}; -use std::io; -use ethtrie::TrieError; - -/// Client configuration errors. -#[derive(Debug)] -pub enum Error { - /// TrieDB-related error. - Trie(TrieError), - /// Io error. - Io(io::Error), -} - -impl From for Error { - fn from(err: TrieError) -> Self { - Error::Trie(err) - } -} - -impl From for Error { - fn from(err: io::Error) -> Self { - Error::Io(err) - } -} - -impl From> for Error where Error: From { - fn from(err: Box) -> Self { - Error::from(*err) - } -} - -impl Display for Error { - fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> { - match *self { - Error::Trie(ref err) => write!(f, "{}", err), - Error::Io(ref err) => write!(f, "{}", err), - } - } -} diff --git a/ethcore/src/client/mod.rs b/ethcore/src/client/mod.rs index 8c5abf3f5..ffd303c12 100644 --- a/ethcore/src/client/mod.rs +++ b/ethcore/src/client/mod.rs @@ -19,7 +19,6 @@ mod ancient_import; mod client; mod config; -mod error; #[cfg(any(test, feature = "test-helpers"))] mod evm_test_client; mod io_message; @@ -29,7 +28,6 @@ mod trace; pub use self::client::*; pub use self::config::{Mode, ClientConfig, DatabaseCompactionProfile, BlockChainConfig, VMType}; -pub use self::error::Error; #[cfg(any(test, feature = "test-helpers"))] pub use self::evm_test_client::{EvmTestClient, EvmTestError, TransactResult}; pub use self::io_message::ClientIoMessage; diff --git a/ethcore/src/error.rs b/ethcore/src/error.rs index 88b50f813..75b2b5175 100644 --- a/ethcore/src/error.rs +++ b/ethcore/src/error.rs @@ -24,7 +24,6 @@ use unexpected::{Mismatch, OutOfBounds}; use ethtrie::TrieError; use io::*; use header::BlockNumber; -use client::Error as ClientError; use snapshot::Error as SnapshotError; use engines::EngineError; use ethkey::Error as EthkeyError; @@ -250,12 +249,6 @@ error_chain! { } errors { - #[doc = "Client configuration error."] - Client(err: ClientError) { - description("Client configuration error.") - display("Client configuration error {}", err) - } - #[doc = "Snapshot error."] Snapshot(err: SnapshotError) { description("Snapshot error.") @@ -297,15 +290,6 @@ error_chain! { /// Result of import block operation. pub type ImportResult = EthcoreResult; -impl From for Error { - fn from(err: ClientError) -> Error { - match err { - ClientError::Trie(err) => ErrorKind::Trie(err).into(), - _ => ErrorKind::Client(err).into() - } - } -} - impl From for Error { fn from(err: AccountsError) -> Error { ErrorKind::AccountProvider(err).into()