use std::path::PathBuf;
pub type ConformResult<T> = Result<T, ConformError>;
#[derive(Debug, thiserror::Error)]
pub enum ConformError {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("EDL error: {0}")]
Edl(String),
#[error("AAF error: {0}")]
Aaf(String),
#[error("XML parsing error: {0}")]
Xml(#[from] quick_xml::Error),
#[error("Database error: {0}")]
Database(String),
#[error("Missing source file: {0}")]
MissingSource(PathBuf),
#[error("No matching source found for clip: {0}")]
NoMatch(String),
#[error("Ambiguous matches found for clip {clip}: {count} candidates")]
AmbiguousMatch {
clip: String,
count: usize,
},
#[error("Invalid timecode: {0}")]
InvalidTimecode(String),
#[error("Timecode mismatch: expected {expected}, found {found}")]
TimecodeMismatch {
expected: String,
found: String,
},
#[error("Invalid frame rate: {0}")]
InvalidFrameRate(String),
#[error("Unsupported format: {0}")]
UnsupportedFormat(String),
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
#[error("Missing required field: {0}")]
MissingField(String),
#[error("Invalid range: {0}")]
InvalidRange(String),
#[error("Export error: {0}")]
Export(String),
#[error("Validation error: {0}")]
Validation(String),
#[error("Checksum mismatch for {path}: expected {expected}, found {found}")]
ChecksumMismatch {
path: PathBuf,
expected: String,
found: String,
},
#[error("Duration mismatch for {path}: expected {expected}s, found {found}s")]
DurationMismatch {
path: PathBuf,
expected: f64,
found: f64,
},
#[error("Insufficient handles for clip {clip}: need {needed} frames, have {available} frames")]
InsufficientHandles {
clip: String,
needed: u64,
available: u64,
},
#[error("Session not found: {0}")]
SessionNotFound(String),
#[cfg(not(target_arch = "wasm32"))]
#[error("Async task error: {0}")]
TaskJoin(#[from] tokio::task::JoinError),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("{0}")]
Other(String),
}
impl From<String> for ConformError {
fn from(s: String) -> Self {
Self::Other(s)
}
}
impl From<&str> for ConformError {
fn from(s: &str) -> Self {
Self::Other(s.to_string())
}
}