1use std::fmt::Display;
2
3#[derive(Debug)]
4#[non_exhaustive]
5pub enum FfProbeError {
6 Io(std::io::Error),
7 Status(std::process::Output),
8 Deserialize(serde_json::Error),
9}
10
11impl Display for FfProbeError {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 match self {
14 FfProbeError::Io(e) => e.fmt(f),
15 FfProbeError::Status(o) => {
16 write!(
17 f,
18 "ffprobe exited with status code {}: {}",
19 o.status,
20 String::from_utf8_lossy(&o.stdout)
21 )
22 }
23 FfProbeError::Deserialize(e) => e.fmt(f),
24 }
25 }
26}
27
28impl std::error::Error for FfProbeError {}