mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor(net): deduplicate error variants (#619)
This commit is contained in:
@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user