lofty-rs/src/error.rs
Serial 4cc33b5e53 Start work on wav decoding
Very few IDs supported right now, test doesn't work yet, and this only supports RIFF INFO chunks, ID3 has to wait for https://github.com/polyfloyd/rust-id3/pull/64

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
2021-04-17 15:42:06 -04:00

44 lines
1.2 KiB
Rust

/// Errors that could occur within Lofty.
#[derive(thiserror::Error, Debug)]
pub enum Error {
/// Unknown file extension.
#[error("Failed to guess the metadata format based on the file extension.")]
UnknownFileExtension,
/// Unsupported file extension
#[error("Unsupported format: {0}")]
UnsupportedFormat(String),
#[error("Unsupported mime type: {0}")]
UnsupportedMimeType(String),
#[error(transparent)]
ApeTag(#[from] ape::Error),
#[error(transparent)]
FlacTag(#[from] metaflac::Error),
#[error(transparent)]
Id3Tag(#[from] id3::Error),
#[error(transparent)]
Mp4Tag(#[from] mp4ameta::Error),
#[error(transparent)]
OpusTag(#[from] opus_headers::ParseError),
#[error(transparent)]
Lewton(#[from] lewton::VorbisError),
#[error(transparent)]
Ogg(#[from] ogg::OggReadError),
#[error("{0}")]
Wav(String),
#[error("")]
NotAPicture,
#[error(transparent)]
Utf8(#[from] std::str::Utf8Error),
#[error(transparent)]
FromUtf8(#[from] std::string::FromUtf8Error),
/// Represents all cases of `std::io::Error`.
#[error(transparent)]
IO(#[from] std::io::Error),
}
/// Type alias for the result of tag operations.
pub type Result<T> = std::result::Result<T, Error>;