Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 36 variants Transport(String), Decode(DecodeError), Version, UnexpectedStream, BoundsExceeded(BoundsExceeded), InvalidPath(InvalidPattern), Duplicate, Cancel, Timeout, Old, App(u16), NotFound, Unroutable, WrongSize, ProtocolViolation, Unauthorized, UnexpectedMessage, Unsupported, Encode(EncodeError), TooManyParameters, UnknownAlpn(String), Dropped, Closed, Lagged, FrameTooLarge, GroupTooLarge, FrameOpen, TimestampMismatch, Evicted, GoingAway, GoawayTimeout, MalformedTrack, SessionClosed, Session(SessionError), Stream(StreamError), Remote(u32),
}
Expand description

Failures in this crate, both local conditions and codes received off the wire.

Local conditions are the flat variants (Cancel, NotFound, Lagged, and so on): this side decided what went wrong. Codes received from a peer are nested in Self::Session or Self::Stream, preserving the registry and the numeric value. Self::Remote is an unrecognized request-rejection code (the IETF request registry), not a session or stream unknown.

The two registries are the wire. Mapping a local condition onto a code is SessionError::from / StreamError::from; folding the flat variants into those registries is a later decision.

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.
§

Transport(String)

The underlying QUIC/WebTransport connection failed; carries the backend’s message.

§

Decode(DecodeError)

A message off the wire could not be parsed.

§

Version

Version negotiation failed, or the negotiated version lacks a requested feature (e.g. a FETCH against a version without fetch support). Mostly a connect-time error, but the feature-gap case can surface mid-session, so it can’t simply move to a connect-only error type.

§

UnexpectedStream

A known stream type arrived where this version or state does not allow it. Closes the session as a protocol violation, or resets just the stream when it can be refused on its own.

§

BoundsExceeded(BoundsExceeded)

An integer was too large for the QUIC varint range.

§

InvalidPath(InvalidPattern)

A path holds a segment no pattern can spell (* or **), so it can never be announced or matched.

§

Duplicate

A duplicate ID was used

§

Cancel

Nobody is reading any more, so the producer stopped. Not a failure.

§

Timeout

It took too long to open or transmit a stream.

§

Old

The group is older than the latest group and dropped.

§

App(u16)

An application-chosen close code. Bounded to u16 and offset past the library’s reserved range (+ 64) on the wire by SessionError::to_code / StreamError::to_code, so app codes never collide with protocol ones.

The width asymmetry with Self::Remote is deliberate: App is a code this side chooses to send, while Remote carries a raw code received off the wire that didn’t map to a known variant, which can be any u32.

§

NotFound

The requested broadcast or track does not exist at the peer.

§

Unroutable

A broadcast was requested that is neither announced nor served by a dynamic router, so there is no route to it.

§

WrongSize

A frame’s payload length disagreed with its declared size.

§

ProtocolViolation

The peer broke a protocol rule; the session is unusable.

§

Unauthorized

The requested path or operation is not granted, either by the peer’s token or by the scope of the handle it was requested through.

§

UnexpectedMessage

A valid message arrived in a state where it is not allowed.

§

Unsupported

The peer asked for a feature this endpoint does not implement.

§

Encode(EncodeError)

A message could not be serialized for the negotiated version.

§

TooManyParameters

A message carried more parameters than this endpoint accepts.

§

UnknownAlpn(String)

The peer offered an ALPN this endpoint doesn’t recognize, so no version could be negotiated. A connect-time error.

§

Dropped

The producer was dropped without finishing, so the content is incomplete.

§

Closed

The handle was already closed by this side.

§

Lagged

The reader asked for a frame the group never held: below crate::group::Producer::start_at, or skipped past a splice. Named from the consumer’s side; distinct from Self::GroupTooLarge, which aborts the whole group when a write exceeds the cache budget, and from Self::Evicted, which drops a whole group under the pool’s memory pressure.

§

FrameTooLarge

A frame declared a payload size larger than the receiver accepts.

§

GroupTooLarge

A write would grow the group past its cache budget (byte size or frame count). The write is refused and the group is aborted, so every reader sees the same failure rather than a prefix some of them missed.

§

FrameOpen

A whole-frame write was refused because a frame is already open on the group.

A crate::group::Producer streaming a frame with create_frame blocks the whole-frame writes on every clone of that producer until it finishes, since appending around it would reorder the group.

§

TimestampMismatch

A frame’s timestamp doesn’t match its track’s negotiated timescale: it’s missing on a timed track, present on an untimed track, or carries a different scale than the track advertised.

§

Evicted

The group was evicted by its own track to pay eviction debt under memory pressure (see cache::Pool). Unlike Self::Old, the group was still within the publisher’s window; it can be re-fetched.

§

GoingAway

The session is going away (a GOAWAY was received); new subscribe and announce-interest requests are rejected while existing subscriptions keep flowing.

§

GoawayTimeout

The peer did not close the session within the GOAWAY drain deadline.

Sent as the session termination code when the draining side force-closes after the advertised deadline expires (see crate::goaway::Goaway::timeout).

§

MalformedTrack

The peer could not parse the track’s content.

§

SessionClosed

The stream was torn down because the session closed. The specific reason travels on the session close, not here.

§

Session(SessionError)

A session-scoped protocol error, with its registry and verbatim code.

Produced by from_transport for a session close, and by converting a SessionError. Local conditions use the specific variants above.

§

Stream(StreamError)

A stream-scoped protocol error, with its registry and verbatim code.

The stream counterpart to Self::Session. The two registries are disjoint, so the same integer is a different failure in each.

§

Remote(u32)

An unrecognized request-rejection code (the IETF request registry).

Session and stream unknowns are Self::Session / Self::Stream, not this.

Implementations§

Source§

impl Error

Source

pub fn session(&self) -> Option<&SessionError>

The session-scoped protocol error, if this was received as one.

Source

pub fn stream(&self) -> Option<&StreamError>

The stream-scoped protocol error, if this was received as one.

Source

pub fn from_transport(err: impl Error) -> Self

Convert a transport error into an Error, decoding session close and stream reset codes through their respective registries.

The two spaces are disjoint, so which one applies depends on what failed: a session close decodes via SessionError::from_code, a stream reset via StreamError::from_code. Reading a stream reset with the session table (or the reverse) silently mistranslates, since e.g. 0 is “no error” for a session but an internal error for a stream.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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 Error for Error

Source§

fn session_error(&self) -> Option<(u32, String)>

Returns the error code and reason if this was an application error. Read more
Source§

fn stream_error(&self) -> Option<u32>

Returns the error code if this was a stream error.
Source§

impl From<&Error> for SessionError

Which session code to send for a local error.

Lossy on purpose: Error describes what went wrong locally, while the registry is what the peer can act on. Anything stream-scoped reaching a session close is a bug on our side, so it degrades to SessionError::Internal rather than inventing a code.

Source§

fn from(err: &Error) -> Self

Converts to this type from the input type.
Source§

impl From<&Error> for StreamError

Which stream code to send for a local error.

Session-scoped conditions route through StreamError::Session, which flattens to SESSION_CLOSED on the wire.

Source§

fn from(err: &Error) -> Self

Converts to this type from the input type.
Source§

impl From<BoundsExceeded> for Error

Source§

fn from(source: BoundsExceeded) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for Error

Source§

fn from(source: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<EncodeError> for Error

Source§

fn from(source: EncodeError) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidPattern> for Error

Source§

fn from(source: InvalidPattern) -> Self

Converts to this type from the input type.
Source§

impl From<SessionError> for Error

Preserve the session registry when carrying a protocol error.

Source§

fn from(err: SessionError) -> Self

Converts to this type from the input type.
Source§

impl From<StreamError> for Error

Preserve the stream registry when carrying a protocol error.

Source§

fn from(err: StreamError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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