Skip to main content

timed_metadata/
error.rs

1//! Crate error type.
2use alloc::string::String;
3
4/// Errors produced by conversions and the [`crate::Timeline`] session.
5#[derive(Debug, thiserror::Error)]
6#[non_exhaustive]
7pub enum Error {
8    /// A wall-clock conversion was attempted without a [`crate::TimeAnchor`].
9    #[error("wall-clock conversion requires a TimeAnchor, but none was set")]
10    MissingAnchor,
11    /// An emsg presented to [`crate::convert::emsg_to_scte35`] is not a
12    /// SCTE-35 carriage scheme.
13    #[error("emsg scheme {scheme:?} is not a SCTE-35 carriage scheme")]
14    UnsupportedScheme { scheme: String },
15    /// SCTE-35 parse failure.
16    #[error("SCTE-35: {0}")]
17    Scte35(#[from] scte35_splice::Error),
18    /// emsg parse/serialize failure.
19    #[error("emsg: {0}")]
20    Emsg(#[from] mp4_emsg::Error),
21    /// `EXT-X-DATERANGE` tag could not be parsed.
22    #[error("DATERANGE parse: {0}")]
23    AttrParse(String),
24}
25
26/// Crate result alias.
27pub type Result<T> = core::result::Result<T, Error>;