use crate::error::FileParseError;
use crate::file::FileType;
use lofty_attr::LoftyError;
#[derive(LoftyError)]
#[error(message = "failed to parse WAV file")]
pub struct WavParseError {
#[error(from(
std::io::Error,
crate::error::TagParseError,
crate::iff::error::ChunkParseError,
crate::error::SizeMismatchError,
crate::error::UnknownFormatError,
))]
source: Box<dyn core::error::Error + Send + Sync + 'static>,
}
impl WavParseError {
pub(super) fn message(message: &'static str) -> Self {
Self {
source: message.into(),
}
}
}
impl From<WavParseError> for FileParseError {
fn from(input: WavParseError) -> FileParseError {
Self::new(FileType::Wav, input.source)
}
}