#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error(transparent)]
Backend(Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("unsupported sample rate: {rate} Hz (only 8 kHz and 16 kHz are supported directly)")]
UnsupportedSampleRate {
rate: u32,
},
#[error(
"stream sample rate {actual} Hz does not match expected {expected} Hz for this operation"
)]
IncompatibleSampleRate {
expected: u32,
actual: u32,
},
#[error("invalid chunk length: expected {expected} samples, got {actual}")]
InvalidChunkLength {
expected: usize,
actual: usize,
},
}
pub type Result<T> = std::result::Result<T, Error>;