Skip to main content

Module error_codes

Module error_codes 

Source
Expand description

The error, status and termination code registries that MoQ Transport draft-09 publishes as Code/Reason tables.

Draft-09 predates the IANA registries introduced in later drafts. Every registry here is an inline two-column table with a Code column and a Reason column, and the draft assigns no ALLCAPS symbolic names to the code points. Each variant’s doc comment therefore quotes the draft’s Reason text verbatim so the mapping from the table to the Rust name is checkable by eye; where the draft explains a code in prose, that explanation follows.

§Scope

Draft-09 has six such tables and all six are transcribed here: Section 3.5 (Termination), Section 7.10 (ANNOUNCE_ERROR), Section 7.16 (SUBSCRIBE_ERROR), Section 7.18 (FETCH_ERROR), Section 7.19 (SUBSCRIBE_DONE) and Section 7.26 (SUBSCRIBE_ANNOUNCES_ERROR). Draft-09 assigns code points in two further places, neither of which is a Code/Reason table and neither of which belongs here:

  • Section 7.24 assigns TRACK_STATUS Status Codes 0x00 through 0x04 in a prose list. That registry is closed — the draft says the field “MUST hold one of the following values. Any other value is a malformed message” — which is the opposite of the open registries below, so folding it in would misrepresent it. super::message::TrackStatus carries the field as a raw VarInt.
  • Section 8.1.1.1 assigns Object Status 0x0, 0x1, 0x3, 0x4 and 0x5 (0x2 is not assigned). That registry is super::types::ObjectStatus, next to the data-stream code that reads it.

ANNOUNCE_CANCEL carries an Error Code field with no table of its own, and Section 7.11 says why: “ANNOUNCE_CANCEL uses the same error codes as ANNOUNCE_ERROR”. So its codes are AnnounceErrorCode, and there is no separate registry to transcribe.

§Unrecognised codes

All six registries here are open: the draft says only that an application “SHOULD use a relevant error code”, so a peer may send a code this draft does not define. from_u64 returns None for an unrecognised value rather than failing or widening the enum.

§These are six separate number spaces

The registries are deliberately six distinct types because the same number means different things in each, and the differences are not intuitive:

  • The termination registry is offset by one against the other five. Internal Error is 0x1 in Section 3.5 but 0x0 in all five message-scoped registries, and Unauthorized is 0x2 in Section 3.5 but 0x1 in all five. Reusing a session code as a message code therefore shifts its meaning by a whole row rather than producing an obviously wrong value.
  • 0x2 is Timeout in ANNOUNCE_ERROR, SUBSCRIBE_ERROR, FETCH_ERROR and SUBSCRIBE_ANNOUNCES_ERROR, but Track Ended in SUBSCRIBE_DONE and Unauthorized in the termination registry.
  • 0x4 carries five distinct meanings across the six registries: Duplicate Track Alias, Uninterested, Track Does Not Exist (in both SUBSCRIBE_ERROR and FETCH_ERROR), Going Away and Namespace Prefix Unknown.

Unauthorized also differs in meaning as well as in number: in SessionErrorCode it reports a breached agreement, which the message-scoped registries do not say.

Enums§

AnnounceErrorCode
ANNOUNCE_ERROR codes, from draft-09 Section 7.10 (ANNOUNCE_ERROR).
FetchErrorCode
FETCH_ERROR codes, from draft-09 Section 7.18 (FETCH_ERROR).
SessionErrorCode
Session termination codes, from draft-09 Section 3.5 (Termination).
SubscribeAnnouncesErrorCode
SUBSCRIBE_ANNOUNCES_ERROR codes, from draft-09 Section 7.26 (SUBSCRIBE_ANNOUNCES_ERROR).
SubscribeDoneStatusCode
SUBSCRIBE_DONE status codes, from draft-09 Section 7.19 (SUBSCRIBE_DONE).
SubscribeErrorCode
SUBSCRIBE_ERROR codes, from draft-09 Section 7.16 (SUBSCRIBE_ERROR).
TrackStatusCode
TRACK_STATUS Status Code values (draft-09, Section 7.24).