#[non_exhaustive]pub enum TransportError {
Connect {
target: String,
source: Box<dyn Error + Send + Sync>,
},
ConnectionLost {
reason: String,
},
Send {
name: &'static str,
reason: String,
},
MalformedFrame {
reason: String,
},
Capacity {
limit_bytes: usize,
reason: String,
},
}Expand description
Something went wrong moving bytes. Carries no protocol meaning.
This type belongs to the public taxonomy, not to a transport. It is
defined here, beside Error, because the distinction it draws is one a
caller can act on — failing to connect and losing an established stream
call for different responses — and because a type in this crate’s semver
promise must be owned by the module that makes that promise. The transports
themselves stay private and merely produce these; adding one is not a semver
event (docs/adr/0007-transport-port-shape.md), and it must not become one
by an adapter widening this enum on its own account.
§On the cause of TransportError::Connect
It is a Box<dyn Error> rather than a named type so that no dependency’s
semantic version becomes part of this crate’s. Read it, log it, print its
chain — but do not downcast it: which concrete error arrives there depends
on which transport ran and on the version of the crate underneath it, and
neither is part of the promise made here. Everything worth branching on is
the variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connect
The connection could not be established.
Fields
ConnectionLost
The connection failed or was dropped while in use.
This is transition T5 [docs/spec/02-session-lifecycle.md §2.2]: no
notification is received, the session is not closed, and the client
is still entitled to attempt recovery.
Send
A control request could not be delivered.
Fields
MalformedFrame
The peer sent a frame that cannot be turned into TLCP lines — a binary WebSocket message, or bytes that are not valid UTF-8.
Capacity
The peer sent more than this client is willing to buffer for it.
Every dimension a server controls is capped, because a client that allocates whatever it is told to is one malformed stream away from taking its process with it. The connection is not usable afterwards: what was buffered has been discarded, so the line stream has a hole in it and the session must be recovered rather than resumed.
Trait Implementations§
Source§impl Debug for TransportError
impl Debug for TransportError
Source§impl Display for TransportError
impl Display for TransportError
Source§impl Error for TransportError
impl Error for TransportError
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()