Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 43 variants Transport(String), Decode(DecodeError), Version, UnexpectedStream, BoundsExceeded(BoundsExceeded), InvalidPath, NavigationSegment, Path(Error), Duplicate, Skipped, Cancel, Timeout, Old, App(u16), NotFound, InvalidJoiningRequestId, InvalidRange, Unroutable, WrongSize, ProtocolViolation, Unauthorized, Expired, UnexpectedMessage, Unsupported, Encode(EncodeError), TooManyRequests, UnknownAlpn(String), Dropped, Closed, Lagged, FrameTooLarge, GroupTooLarge, TimestampMismatch, Evicted, GoingAway, GoawayTimeout, MalformedTrack, UnsupportedExtension, Session(SessionError), Stream(StreamError), Remote(u32), IdleTimeout, KeepAlive(KeepAliveError),
}
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. A stream also reads its session ending cleanly, whichever side closed it, as Session(SessionError::Cancel): to the stream that is the session failing under it, while Session::closed reports the clean close itself as Self::Cancel. 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

A path holds a *, which no Prefix can name, so it could never be listed or granted on its own.

§

NavigationSegment

A published broadcast or route contains a literal . or .. segment.

§

Path(Error)

A string is not a valid path, such as one with an empty segment.

§

Duplicate

A duplicate ID was used

§

Skipped

A group was created at a key its track declared skipped: a skip says the key will never be produced, so it is final. See track::Producer::skip_groups.

§

Cancel

Nobody is reading any more, so the producer stopped; or the session closed cleanly, by either side, as Session::closed reports it. 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.

§

InvalidJoiningRequestId

A joining FETCH named a request that is not an active subscription.

§

InvalidRange

A range is empty, lies beyond the published objects, or ends at the oldest group.

§

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.

§

Expired

The authorization token has expired and can be refreshed.

§

UnexpectedMessage

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

§

Unsupported

A feature was asked for that this endpoint, or the wire to the peer, does not implement.

§

Encode(EncodeError)

A message could not be serialized for the negotiated version.

§

TooManyRequests

The peer went past this session’s crate::session::Limits, such as too many announcements.

§

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 or aborting, so the content is incomplete, with no cause to report. A track’s reader sees it only when no request handler can serve the track again, when the producer that served such a request drops too before another reader joins, or when the next producer could not continue it (a JSON log or window): a track nobody wants ends cleanly when its last producer drops.

§

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. Named from the consumer’s side; distinct from Self::Evicted, for frames the group held but shed from its front or dropped whole under memory pressure.

§

FrameTooLarge

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

§

GroupTooLarge

A write could not make room in the group even by shedding its front: what is left, such as the frame in flight, already fills the live tail (32 MiB). The write is refused and the group is aborted.

§

TimestampMismatch

A frame’s timestamp doesn’t fit its track: it’s missing on a timed track, present on an untimed track, out of range for the track’s timescale, or starts a group earlier than the group before it.

§

Evicted

The group was evicted under memory pressure: by its own track to pay eviction debt (see cache::Pool), or by the transport when incomplete messages spent its receive window. Also a read of a frame the group shed from its front, past its live tail or under that debt. Unlike Self::Old, the group was still fresh under the publisher’s max age; 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 drain deadline expires.

§

MalformedTrack

The peer could not parse the track’s content.

§

UnsupportedExtension

The track requires a moq-transport property this endpoint does not understand.

§

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.

§

IdleTimeout

The underlying connection reached its transport idle deadline, or a KeepAlive’s hard limit.

§

KeepAlive(KeepAliveError)

The transport refused the session’s KeepAlive, so the session never opened.

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.

Without either code, the transport’s close_kind decides: an idle timeout is Error::IdleTimeout, a local close is Error::Session(SessionError::Cancel), and anything else is Error::Transport.

Source

pub fn retry(&self) -> Retry

What to do after a request failed with this error: ask the same source again, find another route, or give up. Mirrors retry in js/net/src/error.ts.

A session closing, whatever its code, is the route failing to deliver: whether the session comes back is the connection’s call, not the request’s.

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 close_kind(&self) -> CloseKind

The typed transport condition, independent of application close codes.
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<!> for Error

Lets an entry point taking impl TryInto<Path, Error: Into<Error>> accept a Path too.

Source§

fn from(never: Infallible) -> Self

Converts to this type from the input type.
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<Error> for Error

Source§

fn from(err: Error) -> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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