lofty 0.25.4

Audio metadata library
Documentation
//! WAV file/tag error types

use crate::error::FileParseError;
use crate::file::FileType;

use lofty_attr::LoftyError;

/// Failed to parse a [`WavFile`]
///
/// [`WavFile`]: crate::iff::wav::WavFile
#[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)
	}
}