Skip to main content

ffcine_core/
error.rs

1use std::path::PathBuf;
2
3/// Errors from ffcine and its backends.
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7    #[error("{path}: {source}")]
8    Io {
9        path: PathBuf,
10        source: std::io::Error,
11    },
12    #[error("{path}:{line}: invalid .cube LUT: {msg}")]
13    CubeParse {
14        path: PathBuf,
15        line: usize,
16        msg: String,
17    },
18    #[error("invalid {what}: {value:?}")]
19    Invalid { what: &'static str, value: String },
20    #[error("{path}: {msg}")]
21    Import { path: PathBuf, msg: String },
22    #[error("invalid OTIO JSON: {0}")]
23    Json(#[from] serde_json::Error),
24    /// The selected backend cannot run this (feature disabled, or not built yet).
25    #[error("{0} is not implemented yet")]
26    Unimplemented(&'static str),
27    /// GPU pipeline failure (device setup, libplacebo, hw frames, codecs).
28    #[error("{0}")]
29    Pipeline(String),
30    /// A GPU API call failed (CUDA, NVIDIA optical flow).
31    #[error("{api}: {msg}")]
32    Gpu { api: &'static str, msg: String },
33    #[cfg(feature = "ffmpeg")]
34    #[error("ffmpeg: {0}")]
35    Ffmpeg(#[from] ffmpeg_next::Error),
36}
37
38pub type Result<T, E = Error> = std::result::Result<T, E>;