General Error Variables
The following error variables are defined with the prefixErr 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.SessionErrorwraps*transport.ApplicationErrorand represents errors that affect the whole QUIC connection (session-level errors).moqt.AnnounceError,moqt.SubscribeError,moqt.GroupError,moqt.FetchError, andmoqt.ProbeErroreach wrap*transport.StreamErrorand represent errors that occur on individual QUIC streams (stream-level errors).
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.- SessionErrorCode
- AnnounceErrorCode
- SubscribeErrorCode
- GroupErrorCode
- FetchErrorCode
- ProbeErrorCode
Error Handling
Implementations ingomoqt/moqt return specific error types for different error scenarios. You can use type assertions to handle these errors accordingly.
- Example: When
moqt.TrackWriterreturns 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 getcontext.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.
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.