reth_network_api/
error.rs

1use thiserror::Error;
2use tokio::sync::{mpsc, oneshot};
3
4/// Network Errors
5#[derive(Error, Debug, Clone, PartialEq, Eq)]
6pub enum NetworkError {
7    /// Indicates that the sender has been dropped.
8    #[error("sender has been dropped")]
9    ChannelClosed,
10}
11
12impl<T> From<mpsc::error::SendError<T>> for NetworkError {
13    fn from(_: mpsc::error::SendError<T>) -> Self {
14        Self::ChannelClosed
15    }
16}
17
18impl From<oneshot::error::RecvError> for NetworkError {
19    fn from(_: oneshot::error::RecvError) -> Self {
20        Self::ChannelClosed
21    }
22}