Skip to main content

TransportError

Enum TransportError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§code: u64

The peer’s application close code.

§reason: String

quinn’s own rendering of the close, which is the peer’s reason phrase where it sent one and the code where it did not.

Trait Implementations§

Source§

impl Debug for TransportError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TransportError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for TransportError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ClosedStream> for TransportError

Source§

fn from(_e: ClosedStream) -> Self

Converts to this type from the input type.
Source§

impl From<ConnectError> for TransportError

Source§

fn from(e: ConnectError) -> Self

Converts to this type from the input type.
Source§

impl From<ConnectionError> for TransportError

Source§

fn from(e: ConnectionError) -> Self

Converts to this type from the input type.
Source§

impl From<ReadError> for TransportError

Source§

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

Source§

fn from(e: ReadExactError) -> Self

Converts to this type from the input type.
Source§

impl From<SendDatagramError> for TransportError

Source§

fn from(e: SendDatagramError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ConnectionError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for DialError

Source§

fn from(source: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<WriteError> for TransportError

Source§

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more