pub enum Error {
Closed,
Timeout,
Transport(Arc<Error>),
Remote(Error),
UnexpectedResponse {
expected: &'static str,
received: &'static str,
},
WrongDirection(&'static str),
TooLarge(usize),
Malformed,
InboundRequestLimitExceeded(usize),
InboundByteLimitExceeded(usize),
}Expand description
Failure of a protocol operation.
A remote application’s error is carried by Error::Remote, and it does
not by itself end the session.
Variants§
Closed
The session or server was closed locally, including by dropping its owner.
Timeout
The operation’s absolute deadline expired.
Remote work may still run.
Transport(Arc<Error>)
The underlying transport failed or the peer reset the session.
Remote(Error)
The peer returned an application error for this request.
UnexpectedResponse
A Message variant differs from the payload type it
is converted to.
Promise::wait returns it for a response of the
wrong type. This does not end the session.
Fields
WrongDirection(&'static str)
The submitted message cannot be sent from this session’s side.
It is reported through the request or reply promise and does not end
the session. Converting a Message into the content
oneof of a direction it cannot travel in fails with this error too.
TooLarge(usize)
The encoded message exceeds the transport’s sending limit,
transport::MAX_MESSAGE_SIZE.
It carries the encoded size in bytes.
Malformed
The peer sent an invalid envelope or payload.
The session closes when this is detected. Nested payloads are checked
only when Session::recv or
Promise::wait reads them.
InboundRequestLimitExceeded(usize)
A peer request would exceed the session’s request limit.
It also occurs when the limit is lowered below usage. It carries the configured request limit and closes the session.
InboundByteLimitExceeded(usize)
Buffering an incoming envelope would exceed the session’s byte limit.
It also occurs when the limit is lowered below usage. It carries the configured byte limit and closes the session.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<!> for Error
impl From<!> for Error
Source§fn from(error: Infallible) -> Self
fn from(error: Infallible) -> Self
Allows Promise::wait to return a
Message without extracting a variant.