ssai_runtime/error.rs
1//! Crate error type.
2
3use alloc::string::String;
4
5/// Errors produced by session, decision, splice-conditioning, and playlist
6/// rendering operations.
7#[derive(Debug, thiserror::Error)]
8#[non_exhaustive]
9pub enum Error {
10 /// [`crate::splice::condition_splice_point`] found no candidate boundary
11 /// within the caller's tolerance.
12 #[error(
13 "no candidate splice boundary within {tolerance_ticks} ticks of requested pts \
14 {requested_pts} (nearest delta {nearest_delta_ticks} ticks)"
15 )]
16 NoAlignedBoundary {
17 /// The cue's nominal target.
18 requested_pts: u64,
19 /// The caller's maximum acceptable drift.
20 tolerance_ticks: u64,
21 /// The delta of the nearest candidate actually found.
22 nearest_delta_ticks: u64,
23 },
24 /// [`crate::splice::condition_splice_point`] was called with an empty
25 /// candidate slice.
26 #[error("no candidate splice boundaries supplied")]
27 NoCandidates,
28 /// An interstitial asset source was neither `X-ASSET-URI` nor
29 /// `X-ASSET-LIST` — Appendix D §D.2 requires exactly one.
30 #[error("interstitial asset source must be exactly one of X-ASSET-URI or X-ASSET-LIST")]
31 InvalidAssetSource,
32 /// [`crate::session::SessionStore`] has no record for the session.
33 #[error("session {0:?} has no active ad break")]
34 NoActiveBreak(String),
35 /// [`crate::session::SessionStore::begin_break`] was called for a
36 /// session that already has an unresumed break.
37 #[error("session {0:?} already has an active ad break")]
38 BreakAlreadyActive(String),
39 /// An Interstitial `EXT-X-DATERANGE` tag line failed to parse.
40 #[error("interstitial DATERANGE parse: {0}")]
41 TagParse(String),
42}
43
44/// Crate result alias.
45pub type Result<T> = core::result::Result<T, Error>;