oximedia_conform/
error.rs1use std::path::PathBuf;
4
5pub type ConformResult<T> = Result<T, ConformError>;
7
8#[derive(Debug, thiserror::Error)]
10pub enum ConformError {
11 #[error("I/O error: {0}")]
13 Io(#[from] std::io::Error),
14
15 #[error("EDL error: {0}")]
17 Edl(String),
18
19 #[error("AAF error: {0}")]
21 Aaf(String),
22
23 #[error("XML parsing error: {0}")]
25 Xml(#[from] quick_xml::Error),
26
27 #[error("Database error: {0}")]
29 Database(String),
30
31 #[error("Missing source file: {0}")]
33 MissingSource(PathBuf),
34
35 #[error("No matching source found for clip: {0}")]
37 NoMatch(String),
38
39 #[error("Ambiguous matches found for clip {clip}: {count} candidates")]
41 AmbiguousMatch {
42 clip: String,
44 count: usize,
46 },
47
48 #[error("Invalid timecode: {0}")]
50 InvalidTimecode(String),
51
52 #[error("Timecode mismatch: expected {expected}, found {found}")]
54 TimecodeMismatch {
55 expected: String,
57 found: String,
59 },
60
61 #[error("Invalid frame rate: {0}")]
63 InvalidFrameRate(String),
64
65 #[error("Unsupported format: {0}")]
67 UnsupportedFormat(String),
68
69 #[error("Invalid configuration: {0}")]
71 InvalidConfig(String),
72
73 #[error("Missing required field: {0}")]
75 MissingField(String),
76
77 #[error("Invalid range: {0}")]
79 InvalidRange(String),
80
81 #[error("Export error: {0}")]
83 Export(String),
84
85 #[error("Validation error: {0}")]
87 Validation(String),
88
89 #[error("Checksum mismatch for {path}: expected {expected}, found {found}")]
91 ChecksumMismatch {
92 path: PathBuf,
94 expected: String,
96 found: String,
98 },
99
100 #[error("Duration mismatch for {path}: expected {expected}s, found {found}s")]
102 DurationMismatch {
103 path: PathBuf,
105 expected: f64,
107 found: f64,
109 },
110
111 #[error("Insufficient handles for clip {clip}: need {needed} frames, have {available} frames")]
113 InsufficientHandles {
114 clip: String,
116 needed: u64,
118 available: u64,
120 },
121
122 #[error("Session not found: {0}")]
124 SessionNotFound(String),
125
126 #[cfg(not(target_arch = "wasm32"))]
128 #[error("Async task error: {0}")]
129 TaskJoin(#[from] tokio::task::JoinError),
130
131 #[error("Serialization error: {0}")]
133 Serialization(#[from] serde_json::Error),
134
135 #[error("{0}")]
137 Other(String),
138}
139
140impl From<String> for ConformError {
141 fn from(s: String) -> Self {
142 Self::Other(s)
143 }
144}
145
146impl From<&str> for ConformError {
147 fn from(s: &str) -> Self {
148 Self::Other(s.to_string())
149 }
150}