Split IO and network crates (#1828)
* Abort on panic * Split IO and network crates * Restore panic handler * Fixed doc tests
This commit is contained in:
committed by
Marek Kotewicz
parent
08f30fc1a8
commit
05bfdc508e
@@ -17,9 +17,7 @@
|
||||
//! General error types for use in ethcore.
|
||||
|
||||
use rustc_serialize::hex::FromHexError;
|
||||
use network::NetworkError;
|
||||
use rlp::DecoderError;
|
||||
use io;
|
||||
use std::fmt;
|
||||
use hash::H256;
|
||||
|
||||
@@ -50,18 +48,10 @@ pub enum UtilError {
|
||||
Crypto(::crypto::CryptoError),
|
||||
/// Error concerning the Rust standard library's IO subsystem.
|
||||
StdIo(::std::io::Error),
|
||||
/// Error concerning our IO utility subsystem.
|
||||
Io(io::IoError),
|
||||
/// Error concerning the network address parsing subsystem.
|
||||
AddressParse(::std::net::AddrParseError),
|
||||
/// Error concerning the network address resolution subsystem.
|
||||
AddressResolve(Option<::std::io::Error>),
|
||||
/// Error concerning the hex conversion logic.
|
||||
FromHex(FromHexError),
|
||||
/// Error concerning the database abstraction logic.
|
||||
BaseData(BaseDataError),
|
||||
/// Error concerning the network subsystem.
|
||||
Network(NetworkError),
|
||||
/// Error concerning the RLP decoder.
|
||||
Decoder(DecoderError),
|
||||
/// Miscellaneous error described by a string.
|
||||
@@ -77,13 +67,8 @@ impl fmt::Display for UtilError {
|
||||
match *self {
|
||||
UtilError::Crypto(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::StdIo(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::Io(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::AddressParse(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::AddressResolve(Some(ref err)) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::AddressResolve(_) => f.write_str("Failed to resolve network address."),
|
||||
UtilError::FromHex(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::BaseData(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::Network(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::Decoder(ref err) => f.write_fmt(format_args!("{}", err)),
|
||||
UtilError::SimpleString(ref msg) => f.write_str(msg),
|
||||
UtilError::BadSize => f.write_str("Bad input size."),
|
||||
@@ -143,36 +128,18 @@ impl From<BaseDataError> for UtilError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<NetworkError> for UtilError {
|
||||
fn from(err: NetworkError) -> UtilError {
|
||||
UtilError::Network(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::std::io::Error> for UtilError {
|
||||
fn from(err: ::std::io::Error) -> UtilError {
|
||||
UtilError::StdIo(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::IoError> for UtilError {
|
||||
fn from(err: io::IoError) -> UtilError {
|
||||
UtilError::Io(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::crypto::CryptoError> for UtilError {
|
||||
fn from(err: ::crypto::CryptoError) -> UtilError {
|
||||
UtilError::Crypto(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::std::net::AddrParseError> for UtilError {
|
||||
fn from(err: ::std::net::AddrParseError) -> UtilError {
|
||||
UtilError::AddressParse(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::rlp::DecoderError> for UtilError {
|
||||
fn from(err: ::rlp::DecoderError) -> UtilError {
|
||||
UtilError::Decoder(err)
|
||||
|
||||
Reference in New Issue
Block a user