55 lines
1.4 KiB
Rust
55 lines
1.4 KiB
Rust
//! FLAC errors
|
|
use std::string::FromUtf8Error;
|
|
use thiserror::Error;
|
|
|
|
#[expect(missing_docs)]
|
|
#[derive(Debug, Error)]
|
|
pub enum FlacDecodeError {
|
|
/// FLAC does not start with 0x66 0x4C 0x61 0x43
|
|
#[error("flac signature is missing or malformed")]
|
|
BadMagicBytes,
|
|
|
|
/// The first metablock isn't StreamInfo
|
|
#[error("first metablock isn't streaminfo")]
|
|
BadFirstBlock,
|
|
|
|
/// We got an invalid metadata block type
|
|
#[error("invalid flac metablock type {0}")]
|
|
BadMetablockType(u8),
|
|
|
|
/// We encountered an i/o error while processing
|
|
#[error("i/o error")]
|
|
IoError(#[from] std::io::Error),
|
|
|
|
/// We tried to decode a string, but found invalid UTF-8
|
|
#[error("could not decode string")]
|
|
FailedStringDecode(#[from] FromUtf8Error),
|
|
|
|
/// We tried to read a block, but it was out of spec.
|
|
#[error("malformed flac block")]
|
|
MalformedBlock,
|
|
|
|
/// We could not parse a vorbis comment string
|
|
#[error("malformed vorbis comment string: {0:?}")]
|
|
MalformedCommentString(String),
|
|
|
|
/// We could not parse a vorbis comment string
|
|
#[error("malformed vorbis picture")]
|
|
MalformedPicture(base64::DecodeError),
|
|
|
|
/// We didn't find frame sync bytes where we expected them
|
|
#[error("bad frame sync bytes")]
|
|
BadSyncBytes,
|
|
|
|
#[error("invalid picture type {0}")]
|
|
InvalidPictureType(u32),
|
|
}
|
|
|
|
#[expect(missing_docs)]
|
|
#[derive(Debug, Error)]
|
|
pub enum FlacEncodeError {
|
|
/// We encountered an i/o error while processing
|
|
#[error("i/o error")]
|
|
IoError(#[from] std::io::Error),
|
|
}
|