Skip to main content

moq_rtc/
error.rs

1/// Errors produced by the WebRTC <-> MoQ gateway.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum Error {
5	/// An SDP offer or answer failed to parse or was missing something required.
6	#[error("invalid SDP: {0}")]
7	InvalidSdp(String),
8
9	/// The negotiated payload used a codec this gateway can't bridge to MoQ.
10	#[error("unsupported codec: {0}")]
11	UnsupportedCodec(String),
12
13	/// No live session matched the resource id (e.g. a DELETE for an unknown id).
14	#[error("session not found")]
15	SessionNotFound,
16
17	/// The peer closed the session; the media session ended without a failure.
18	#[error("session closed")]
19	SessionClosed,
20
21	/// ICE connectivity was not established before the establishment deadline.
22	#[error("ICE did not connect before the establishment deadline")]
23	IceTimeout,
24
25	/// I/O error on the media socket (bind, send, or receive).
26	#[error("io error: {0}")]
27	Io(#[from] std::io::Error),
28
29	/// Error from the underlying moq-net transport.
30	#[error("moq error: {0}")]
31	Moq(#[from] moq_net::Error),
32
33	/// Error from the moq-mux import/export layer bridging RTP and MoQ.
34	#[error("mux error: {0}")]
35	Mux(#[from] moq_mux::Error),
36
37	/// Error from the str0m WebRTC engine (SDP negotiation, DTLS, media state).
38	#[error("rtc error: {0}")]
39	Rtc(#[from] str0m::RtcError),
40
41	/// Error feeding a received UDP datagram into the str0m WebRTC engine.
42	#[error("rtc input error: {0}")]
43	RtcInput(#[from] str0m::error::NetError),
44
45	/// Catch-all for gateway logic that reports via `anyhow`.
46	#[error(transparent)]
47	Other(#[from] anyhow::Error),
48}
49
50/// Convenience alias for results from the WebRTC <-> MoQ gateway.
51pub type Result<T> = std::result::Result<T, Error>;