#[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
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.
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.
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
impl Error
Sourcepub fn session(&self) -> Option<&SessionError>
pub fn session(&self) -> Option<&SessionError>
The session-scoped protocol error, if this was received as one.
Sourcepub fn stream(&self) -> Option<&StreamError>
pub fn stream(&self) -> Option<&StreamError>
The stream-scoped protocol error, if this was received as one.
Sourcepub fn from_transport(err: impl Error) -> Self
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.
Sourcepub fn retry(&self) -> Retry
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 Error for Error
impl Error for Error
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 Error for Error
impl Error for Error
Source§fn close_kind(&self) -> CloseKind
fn close_kind(&self) -> CloseKind
Source§fn session_error(&self) -> Option<(u32, String)>
fn session_error(&self) -> Option<(u32, String)>
Source§fn stream_error(&self) -> Option<u32>
fn stream_error(&self) -> Option<u32>
Source§impl From<!> for Error
Lets an entry point taking impl TryInto<Path, Error: Into<Error>> accept a Path too.
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
fn from(never: Infallible) -> Self
Source§impl From<&Error> for SessionError
Which session code to send for a local error.
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§impl From<&Error> for StreamError
Which stream code to send for a local error.
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§impl From<BoundsExceeded> for Error
impl From<BoundsExceeded> for Error
Source§fn from(source: BoundsExceeded) -> Self
fn from(source: BoundsExceeded) -> Self
Source§impl From<DecodeError> for Error
impl From<DecodeError> for Error
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Source§impl From<EncodeError> for Error
impl From<EncodeError> for Error
Source§fn from(source: EncodeError) -> Self
fn from(source: EncodeError) -> Self
Source§impl From<SessionError> for Error
Preserve the session registry when carrying a protocol error.
impl From<SessionError> for Error
Preserve the session registry when carrying a protocol error.
Source§fn from(err: SessionError) -> Self
fn from(err: SessionError) -> Self
Source§impl From<StreamError> for Error
Preserve the stream registry when carrying a protocol error.
impl From<StreamError> for Error
Preserve the stream registry when carrying a protocol error.