extern crate alloc;
use alloc::string::String;
use thiserror::Error;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("XML parse error: {0}")]
XmlParse(String),
#[error("expected root element <tt> in namespace http://www.w3.org/ns/ttml, got {0}")]
NotTtmlRoot(String),
#[error("missing required element: {0}")]
MissingElement(&'static str),
#[error("missing required attribute '{attr}' on element '{element}'")]
MissingAttribute {
element: &'static str,
attr: &'static str,
},
#[error("invalid value for attribute '{attr}' on element '{element}': {reason}")]
InvalidAttribute {
element: &'static str,
attr: &'static str,
reason: String,
},
#[error("invalid time expression '{value}': {reason}")]
InvalidTimeExpression {
value: String,
reason: String,
},
#[error("IMSC validation error: {0}")]
Validation(String),
#[error("unexpected element '{name}' in namespace '{ns}'")]
UnexpectedElement {
name: String,
ns: String,
},
#[error("prohibited element '{name}' for the claimed profile")]
ProhibitedElement {
name: String,
},
#[error("prohibited attribute '{attr}' for the claimed profile")]
ProhibitedAttribute {
attr: String,
},
#[error("{constraint}: {detail}")]
ConstraintViolation {
constraint: String,
detail: String,
},
#[error("serialization error: {0}")]
Serialize(String),
}