Merge pull request #7040 from paritytech/squashed_network_error_chain
squashed ethcore-network changes which introduce error-chain
This commit is contained in:
@@ -17,10 +17,8 @@
|
||||
//! Defines error types and levels of punishment to use upon
|
||||
//! encountering.
|
||||
|
||||
use rlp::DecoderError;
|
||||
use network::NetworkError;
|
||||
|
||||
use std::fmt;
|
||||
use {rlp, network};
|
||||
|
||||
/// Levels of punishment.
|
||||
///
|
||||
@@ -41,9 +39,9 @@ pub enum Punishment {
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// An RLP decoding error.
|
||||
Rlp(DecoderError),
|
||||
Rlp(rlp::DecoderError),
|
||||
/// A network error.
|
||||
Network(NetworkError),
|
||||
Network(network::Error),
|
||||
/// Out of credits.
|
||||
NoCredits,
|
||||
/// Unrecognized packet code.
|
||||
@@ -92,14 +90,14 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DecoderError> for Error {
|
||||
fn from(err: DecoderError) -> Self {
|
||||
impl From<rlp::DecoderError> for Error {
|
||||
fn from(err: rlp::DecoderError) -> Self {
|
||||
Error::Rlp(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<NetworkError> for Error {
|
||||
fn from(err: NetworkError) -> Self {
|
||||
impl From<network::Error> for Error {
|
||||
fn from(err: network::Error) -> Self {
|
||||
Error::Network(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user