use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum DecodeError {
#[error("cannot open {}: {source}", path.display())]
Open {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("read failed: {0}")]
Read(#[source] std::io::Error),
#[error("unsupported or unrecognized audio format: {0}")]
UnsupportedFormat(String),
#[error("no audio track found in input")]
NoAudioTrack,
#[error("audio track has no declared sample rate")]
MissingSampleRate,
#[error("audio track declares an unsupported sample rate of {0} Hz")]
UnsupportedSampleRate(u32),
#[error("audio is longer than the configured limit of {limit_s} s")]
TooLong { limit_s: f32 },
#[error("decode error: {0}")]
Decode(String),
#[error("resample error: {0}")]
Resample(String),
#[error("invalid decode config: {0}")]
InvalidConfig(&'static str),
}