Skip to main content

General Error Variables

The following error variables are defined with the prefix Err and are used for general-purpose error handling:

Protocol Error Types

The following error types are defined to represent specific protocol error scenarios. Each type wraps error codes and provides methods for error handling and inspection:

Relationship with QUIC errors

The concrete MoQ error types map directly onto the QUIC error primitives:
  • moqt.SessionError wraps *transport.ApplicationError and represents errors that affect the whole QUIC connection (session-level errors).
  • moqt.AnnounceError, moqt.SubscribeError, moqt.GroupError, moqt.FetchError, and moqt.ProbeError each wrap *transport.StreamError and represent errors that occur on individual QUIC streams (stream-level errors).
This mapping allows protocol-specific error types to be propagated over QUIC using the appropriate QUIC error mechanism. Each error type implements the error interface and works with Go’s standard error utilities (errors.Is, errors.As).

Built-in Error Codes

Error codes for each custom error type are summarized below. Click each section to toggle visibility.

Error Handling

Implementations in gomoqt/moqt return specific error types for different error scenarios. You can use type assertions to handle these errors accordingly.
  • Example: When moqt.TrackWriter returns an error
Note:MoQ-related errors are always returned from specific structs. When analyzing errors, make sure to perform error handling and analysis at the correct location in the code, according to the struct that returns the error. This ensures accurate diagnosis and handling of protocol errors.

Error Propagation

You can get context.Context via Context method implementated in gomoqt/moqt such as moqt.TrackReader or moqt.Session. moqt.Cause function is provided to access to the root cause of an error propagation and to parse the cause as a MoQ error if it is a QUIC error. This is because the context.Context holds the original QUIC error and context.Cause returns the cause as is.
Example: Get MoQ cause from context.Context
To get the MoQ cause from a context, use errors.As function with corresponding error type. Example: When moqt.TrackWriter’s context is canceled
Note: context.CauseWhen using context.Cause, the raw QUIC error can be accessed directly from the context.