#[non_exhaustive]pub enum TransportError {
Connection(String),
Write(String),
Read(String),
StreamClosed,
SendDatagram(String),
ConnectionLost,
Connect(String),
Handshake(HandshakeFailure),
StreamReset(u64),
Stopped(u64),
SessionClosed {
code: u64,
reason: String,
},
}Expand description
Errors from the transport layer.
#[non_exhaustive] so that a new failure mode is an additive change. The
crate matches on these internally, where the attribute does not apply;
downstream code that matches needs a _ arm, which is the trade being made
deliberately.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connection(String)
Connection-level error (e.g., peer closed, timeout).
Write(String)
Error writing to a stream.
Read(String)
Error reading from a stream.
StreamClosed
Stream was closed.
SendDatagram(String)
Error sending a datagram.
ConnectionLost
Connection was lost.
Connect(String)
Error during connection establishment.
Handshake(HandshakeFailure)
A handshake reached the peer and did not complete, with its codes kept.
Distinct from Connect, which is the same class of
event before there was anything numeric to keep — building the endpoint,
binding the socket, resolving a name. Both render the same way, so this
is additive to anything reading the message.
StreamReset(u64)
The peer abandoned transmission by resetting the stream. Carries
the peer’s application error code so a forwarder can mirror it
verbatim with SendStream::reset.
Stopped(u64)
The peer is no longer accepting data on this stream
(STOP_SENDING). Carries the peer’s application error code so a
forwarder can mirror it verbatim with RecvStream::stop.
SessionClosed
The peer closed the whole session, with the code it named.
Distinct from StreamReset, which ends one stream
and leaves the session alive. Over MoQT this code is a draft’s own
session error — VERSION_NEGOTIATION_FAILED, PROTOCOL_VIOLATION — and
it is the sharpest thing a refusal says.
It exists because quinn renders ReadError::ConnectionLost as the bare
words “connection lost” and drops the cause entirely, so without this
variant a relay that ends a session with a code and a reason phrase
reaches callers as neither. The code is on the value and also in the
message, spelled the way every other code this crate reports is spelled.
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
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()
Source§impl From<ClosedStream> for TransportError
impl From<ClosedStream> for TransportError
Source§impl From<ConnectError> for TransportError
impl From<ConnectError> for TransportError
Source§impl From<ConnectionError> for TransportError
impl From<ConnectionError> for TransportError
Source§impl From<ReadError> for TransportError
impl From<ReadError> for TransportError
Source§fn from(e: ReadError) -> Self
fn from(e: ReadError) -> Self
Reset keeps the peer’s application error code as a typed
TransportError::StreamReset so a forwarder can mirror it;
every other cause collapses to a message.
Source§impl From<ReadExactError> for TransportError
impl From<ReadExactError> for TransportError
Source§impl From<SendDatagramError> for TransportError
impl From<SendDatagramError> for TransportError
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for ConnectionError
impl From<TransportError> for ConnectionError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<TransportError> for DialError
impl From<TransportError> for DialError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Source§impl From<WriteError> for TransportError
impl From<WriteError> for TransportError
Source§fn from(e: WriteError) -> Self
fn from(e: WriteError) -> Self
Stopped keeps the peer’s application error code as a typed
TransportError::Stopped so a forwarder can mirror it; every
other cause collapses to a message.