pub struct Error { /* private fields */ }
Expand description
Opaque error for all RPC operations.
Implementations§
source§impl Error
impl Error
sourcepub fn message_too_short(message_len: usize) -> Self
pub fn message_too_short(message_len: usize) -> Self
Create a new error for a message that is too short to be valid.
sourcepub fn invalid_message_type(value: u32) -> Self
pub fn invalid_message_type(value: u32) -> Self
Create a new error for a message with an invalid message type in the header.
sourcepub fn payload_too_large(body_len: usize, max_len: usize) -> Self
pub fn payload_too_large(body_len: usize, max_len: usize) -> Self
Create a new error for a message with an body that exceeds the allowed size.
sourcepub fn unexpected_service_id(service_id: i32) -> Self
pub fn unexpected_service_id(service_id: i32) -> Self
Create a new error for an incoming message with an unexpected service ID.
sourcepub fn encode_failed(inner: Box<dyn Error + Send>) -> Self
pub fn encode_failed(inner: Box<dyn Error + Send>) -> Self
Create a new error for an outgoing message body that could not be encoded.
sourcepub fn decode_failed(inner: Box<dyn Error + Send>) -> Self
pub fn decode_failed(inner: Box<dyn Error + Send>) -> Self
Create a new error for an incoming message with a body that could not be decoded.
sourcepub fn remote_error(message: String) -> Self
pub fn remote_error(message: String) -> Self
Create a new error for an incoming message that represent an error response from the remote peer.
A remote error does not indicate a communication or protocol violation. It is used when the remote peer correctly received and understood the request, but is unable to succesfully complete it.
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 is_unexpected_message_type(&self) -> bool
pub fn is_unexpected_message_type(&self) -> bool
Check if an unexpected message type was received.
This can happen when you call recv_response()
while an update message is still queued.
sourcepub fn is_remote_error(&self) -> bool
pub fn is_remote_error(&self) -> bool
Check if this error represent an error response from the remote peer.
See Self::remote_error()
for more details on what a remote error is.
sourcepub fn as_remote_error(&self) -> Option<&str>
pub fn as_remote_error(&self) -> Option<&str>
Get this error as remote error message.
See Self::remote_error()
for more details on what a remote error is.
sourcepub fn into_remote_error(self) -> Option<String>
pub fn into_remote_error(self) -> Option<String>
Get this error as remote error message.
See Self::remote_error()
for more details on what a remote error is.