Add error.rs
This commit is contained in:
21
src/error.rs
Normal file
21
src/error.rs
Normal file
@@ -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<T> = std::result::Result<T, ProbeError>;
|
||||||
Reference in New Issue
Block a user