Enum fizyr_rpc::RecvMessageError
source · 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
.