Skip to main content

riff_wave_core/
error.rs

1//! Public error type.
2
3#![forbid(unsafe_code)]
4
5/// Errors from RIFF/WAVE demux.
6#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum Error {
9    /// The leading 12 bytes are not a `RIFF`/`WAVE` header.
10    #[error("not a RIFF/WAVE container")]
11    NotRiffWave,
12    /// No `fmt ` chunk found before end of input.
13    #[error("missing fmt chunk")]
14    MissingFmtChunk,
15    /// `fmt ` chunk is present but shorter than the 16-byte PCM `fmt ` body.
16    #[error("truncated fmt chunk (need at least 16 bytes)")]
17    TruncatedFmtChunk,
18    /// `fmt ` chunk's `wFormatTag` is not PCM (1) or IEEE float (3).
19    #[error("unsupported wFormatTag {0} (only PCM=1 / IEEE float=3 supported)")]
20    UnsupportedFormatTag(u16),
21}