Skip to main content

vecslide_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum VecslideError {
5    #[error("timestamps not ascending at slide index {index}: {detail}")]
6    TimestampOrder { index: usize, detail: String },
7
8    #[error("audio_track field is empty")]
9    EmptyAudioTrack,
10
11    #[error("slides list is empty")]
12    EmptySlides,
13
14    #[error("referenced SVG file not found: {path}")]
15    MissingSvgFile { path: String },
16
17    #[error("slide '{id}' has no source (svg_file, typst_file, or typst_inline must be set)")]
18    NoSlideSource { id: String },
19
20    #[error("slide id '{id}' is not unique")]
21    DuplicateSlideId { id: String },
22
23    #[error("slide '{slide_id}' animation[{anim_index}] has an empty element_id")]
24    EmptyElementId { slide_id: String, anim_index: usize },
25
26    #[error("slide '{slide_id}' has an animation with time_start outside the slide's time range")]
27    AnimationOutOfRange { slide_id: String },
28
29    #[error("transcript segment[{index}] has start_ms >= end_ms")]
30    InvalidSegment { index: usize },
31
32    #[error("transcript segment[{index}] overlaps with the previous segment")]
33    OverlappingSegments { index: usize },
34
35    #[error("typst compilation failed: {0}")]
36    TypstCompile(String),
37
38    #[error("slide count mismatch: typst source has {typst} slides but manifest has {manifest}")]
39    SlideCountMismatch { typst: usize, manifest: usize },
40
41    #[error("YAML error: {0}")]
42    Yaml(#[from] serde_norway::Error),
43
44    #[error("JSON error: {0}")]
45    Json(#[from] serde_json::Error),
46
47    #[error("{0}")]
48    Other(String),
49
50    #[cfg(feature = "zip-io")]
51    #[error("ZIP error: {0}")]
52    Zip(#[from] zip::result::ZipError),
53
54    #[cfg(feature = "zip-io")]
55    #[error("I/O error: {0}")]
56    Io(#[from] std::io::Error),
57}