tanim_cli/video/
error.rs

1use thiserror::Error;
2use typst::{diag::SourceDiagnostic, ecow::EcoVec};
3
4#[derive(Debug, Error)]
5pub enum Error {
6    #[error("Typst compilation failed: {0:?}")]
7    TypstCompilation(EcoVec<SourceDiagnostic>),
8
9    #[error("No pages in the document")]
10    NoPages,
11
12    #[error("Failed to create ndarray from shape: {0}")]
13    NDArrayShape(#[from] ndarray::ShapeError),
14
15    #[error("Video encoding failed: {0}")]
16    VideoEncoding(#[from] video_rs::Error),
17
18    #[error("I/O error: {0}")]
19    Io(#[from] std::io::Error),
20
21    #[error("Failed to send frame to encoder thread")]
22    FrameSendError,
23
24    #[error("Rendering or encoding failed")]
25    RenderOrEncode,
26
27    #[error("Failed to send task to worker thread")]
28    TaskSendError,
29
30    #[error("A thread panicked: {0}")]
31    ThreadPanic(String),
32
33    #[error("Failed to create pixmap for resizing")]
34    PixmapCreation,
35
36    #[error("Failed to create temp file for video encoding")]
37    TempFileCreation(#[source] std::io::Error),
38
39    #[error("Failed to merge video chunks: {0}")]
40    MergeVideoChunks(String),
41}
42
43pub type Result<T> = std::result::Result<T, Error>;