pub enum EthStreamError {
P2PStreamError(P2PStreamError),
ParseVersionError(ParseVersionError),
EthHandshakeError(EthHandshakeError),
InvalidMessage(MessageError),
InvalidSnapMessage(SnapProtocolError),
MessageTooBig(usize),
TransactionHashesInvalidLenOfFields {
hashes_len: usize,
types_len: usize,
sizes_len: usize,
},
StreamTimeout,
UnsupportedMessage {
message_id: u8,
},
UnsolicitedResponse {
message_id: EthMessageID,
request_id: u64,
},
ResponseExceedsRequest {
message_id: EthMessageID,
request_id: u64,
max_items: usize,
},
}Expand description
Errors when sending/receiving messages
Variants§
P2PStreamError(P2PStreamError)
Error of the underlying P2P connection.
ParseVersionError(ParseVersionError)
Failed to parse peer’s version.
EthHandshakeError(EthHandshakeError)
Failed Ethereum handshake.
InvalidMessage(MessageError)
Thrown when decoding a message failed.
InvalidSnapMessage(SnapProtocolError)
Thrown when decoding an inbound snap protocol message failed.
MessageTooBig(usize)
Received a message whose size exceeds the standard limit.
TransactionHashesInvalidLenOfFields
Received malformed transaction hashes message with discrepancies in field lengths.
Fields
StreamTimeout
Error when data is not received from peer for a prolonged period.
UnsupportedMessage
Error triggered when an unknown or unsupported Ethereum message ID is received.
UnsolicitedResponse
Received a response that answers no request sent on this stream.
The response is rejected before its items are decoded.
Fields
message_id: EthMessageIDThe message id of the response.
ResponseExceedsRequest
Received a response with more items than its request asked for.
The response is rejected before its items are decoded.
Implementations§
Source§impl EthStreamError
impl EthStreamError
Sourcepub const fn as_disconnected(&self) -> Option<DisconnectReason>
pub const fn as_disconnected(&self) -> Option<DisconnectReason>
Returns the DisconnectReason if the error is a disconnect message
Sourcepub const fn is_protocol_breach(&self) -> bool
pub const fn is_protocol_breach(&self) -> bool
Returns whether this error indicates a protocol breach on the receive side.
These are errors caused by the remote peer sending invalid or malformed data
that warrant disconnecting with DisconnectReason::ProtocolBreach.
Trait Implementations§
Source§impl Debug for EthStreamError
impl Debug for EthStreamError
Source§impl Display for EthStreamError
impl Display for EthStreamError
Source§impl Error for EthStreamError
impl Error for EthStreamError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for EthStreamError
impl From<Error> for EthStreamError
Source§impl From<EthHandshakeError> for EthStreamError
impl From<EthHandshakeError> for EthStreamError
Source§fn from(source: EthHandshakeError) -> Self
fn from(source: EthHandshakeError) -> Self
Source§impl From<MessageError> for EthStreamError
impl From<MessageError> for EthStreamError
Source§fn from(source: MessageError) -> Self
fn from(source: MessageError) -> Self
Source§impl From<P2PStreamError> for EthStreamError
impl From<P2PStreamError> for EthStreamError
Source§fn from(source: P2PStreamError) -> Self
fn from(source: P2PStreamError) -> Self
Source§impl From<ParseVersionError> for EthStreamError
impl From<ParseVersionError> for EthStreamError
Source§fn from(source: ParseVersionError) -> Self
fn from(source: ParseVersionError) -> Self
Source§impl From<SnapProtocolError> for EthStreamError
impl From<SnapProtocolError> for EthStreamError
Source§fn from(source: SnapProtocolError) -> Self
fn from(source: SnapProtocolError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for EthStreamError
impl !UnwindSafe for EthStreamError
impl Freeze for EthStreamError
impl Send for EthStreamError
impl Sync for EthStreamError
impl Unpin for EthStreamError
impl UnsafeUnpin for EthStreamError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes
Size for each variant:
P2PStreamError: 48 bytesParseVersionError: 32 bytesEthHandshakeError: 48 bytesInvalidMessage: 40 bytesInvalidSnapMessage: 40 bytesMessageTooBig: 16 bytesTransactionHashesInvalidLenOfFields: 32 bytesStreamTimeout: 0 bytesUnsupportedMessage: 9 bytesUnsolicitedResponse: 24 bytesResponseExceedsRequest: 32 bytes