refactor(net): deduplicate error variants (#619)

This commit is contained in:
Matthias Seitz
2022-12-26 23:29:26 +01:00
committed by GitHub
parent 663efa8d2a
commit a2c1cdb399

View File

@ -7,10 +7,6 @@ use std::io;
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub enum EthStreamError {
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Rlp(#[from] reth_rlp::DecodeError),
#[error(transparent)]
P2PStreamError(#[from] P2PStreamError),
#[error(transparent)]
@ -32,6 +28,18 @@ impl EthStreamError {
}
}
impl From<io::Error> for EthStreamError {
fn from(err: io::Error) -> Self {
P2PStreamError::from(err).into()
}
}
impl From<reth_rlp::DecodeError> for EthStreamError {
fn from(err: reth_rlp::DecodeError) -> Self {
P2PStreamError::from(err).into()
}
}
/// Error variants that can occur during the `eth` sub-protocol handshake.
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]