pub enum RecvMessageError<Body> {
Other(Error),
UnknownStream(Message<Body>),
UnknownRequest(ReceivedRequestHandle<Body>, Body),
InvalidStream(MessageHeader, Box<dyn Error + Send>),
InvalidRequest(ReceivedRequestHandle<Body>, Box<dyn Error + Send>),
}Expand description
Error that can occur when receiving a message from a peer using a generated interface.
Apart from the Error reported by PeerHandle::recv_message(),
this error is used when the received message has an unknown service ID or an invalid body.
Variants§
Other(Error)
The underlying call to PeerHandle::recv_message() returned an error.
UnknownStream(Message<Body>)
The received stream message has an unknown service ID.
UnknownRequest(ReceivedRequestHandle<Body>, Body)
The received request has an unknown service ID.
InvalidStream(MessageHeader, Box<dyn Error + Send>)
The received stream message has a known service ID, but an invalid body.
The body has been consumed in the parse attempt, so only the message header and parse error are available.
InvalidRequest(ReceivedRequestHandle<Body>, Box<dyn Error + Send>)
The received request has a known service ID, but an invalid body.
The body has been consumed in the parse attempt, so only the request handle and parse error are available.
Implementations§
Source§impl<Body> RecvMessageError<Body>
impl<Body> RecvMessageError<Body>
Sourcepub fn is_connection_aborted(&self) -> bool
pub fn is_connection_aborted(&self) -> bool
Check if this error is caused by the remote peer closing the connection cleanly.
Sourcepub fn request_handle(&self) -> Option<&ReceivedRequestHandle<Body>>
pub fn request_handle(&self) -> Option<&ReceivedRequestHandle<Body>>
Get the raw request handle associated with the received message.
The request handle can be used to send an error response to unknown or invalid requests.
For errors other than Self::UnknownRequest and Self::InvalidRequest,
this function returns None.
Sourcepub fn request_handle_mut(&mut self) -> Option<&mut ReceivedRequestHandle<Body>>
pub fn request_handle_mut(&mut self) -> Option<&mut ReceivedRequestHandle<Body>>
Get the a mutable reference to the raw request handle associated with the received message.
The request handle can be used to send an error response to unknown or invalid requests.
For errors other than Self::UnknownRequest and Self::InvalidRequest,
this function returns None.
Trait Implementations§
Source§impl<Body> Debug for RecvMessageError<Body>
impl<Body> Debug for RecvMessageError<Body>
Source§impl<Body> Display for RecvMessageError<Body>
impl<Body> Display for RecvMessageError<Body>
Source§impl<Body> Error for RecvMessageError<Body>
impl<Body> Error for RecvMessageError<Body>
1.30.0 · 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()