From 9697cc561a0c4ded40c5d4f476b641d33c925da0 Mon Sep 17 00:00:00 2001 From: Warren Lo Date: Wed, 11 Mar 2026 01:42:33 +0800 Subject: [PATCH] Add error.rs --- src/error.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..2277908 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,21 @@ +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum ProbeError { + #[error("Video file not found: {0}")] + FileNotFound(String), + + #[error("Failed to execute ffprobe: {0}")] + FfprobeExecution(#[from] std::io::Error), + + #[error("Failed to parse ffprobe output: {0}")] + ParseError(#[from] serde_json::Error), + + #[error("ffprobe returned non-zero exit code: {0}")] + FfprobeFailed(String), + + #[error("No video stream found")] + NoVideoStream, +} + +pub type Result = std::result::Result; \ No newline at end of file