Ethcore crate split part 1 (#6041)
* split out types into separate crate * split out evm into its own crate
This commit is contained in:
committed by
Gav Wood
parent
24c8510932
commit
d365281cce
@@ -22,13 +22,12 @@ use header::BlockNumber;
|
||||
use basic_types::LogBloom;
|
||||
use client::Error as ClientError;
|
||||
use ipc::binary::{BinaryConvertError, BinaryConvertable};
|
||||
use types::block_import_error::BlockImportError;
|
||||
use snapshot::Error as SnapshotError;
|
||||
use engines::EngineError;
|
||||
use ethkey::Error as EthkeyError;
|
||||
use account_provider::SignError as AccountsError;
|
||||
|
||||
pub use types::executed::{ExecutionError, CallError};
|
||||
pub use executed::{ExecutionError, CallError};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
/// Errors concerning transaction processing.
|
||||
@@ -239,6 +238,53 @@ impl fmt::Display for ImportError {
|
||||
f.write_fmt(format_args!("Block import error ({})", msg))
|
||||
}
|
||||
}
|
||||
/// Error dedicated to import block function
|
||||
#[derive(Debug)]
|
||||
pub enum BlockImportError {
|
||||
/// Import error
|
||||
Import(ImportError),
|
||||
/// Block error
|
||||
Block(BlockError),
|
||||
/// Other error
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<Error> for BlockImportError {
|
||||
fn from(e: Error) -> Self {
|
||||
match e {
|
||||
Error::Block(block_error) => BlockImportError::Block(block_error),
|
||||
Error::Import(import_error) => BlockImportError::Import(import_error),
|
||||
_ => BlockImportError::Other(format!("other block import error: {:?}", e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the result of importing transaction.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum TransactionImportResult {
|
||||
/// Transaction was imported to current queue.
|
||||
Current,
|
||||
/// Transaction was imported to future queue.
|
||||
Future
|
||||
}
|
||||
|
||||
/// Api-level error for transaction import
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum TransactionImportError {
|
||||
/// Transaction error
|
||||
Transaction(TransactionError),
|
||||
/// Other error
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<Error> for TransactionImportError {
|
||||
fn from(e: Error) -> Self {
|
||||
match e {
|
||||
Error::Transaction(transaction_error) => TransactionImportError::Transaction(transaction_error),
|
||||
_ => TransactionImportError::Other(format!("other block import error: {:?}", e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// General error type which should be capable of representing all errors in ethcore.
|
||||
|
||||
Reference in New Issue
Block a user