2021-04-03 17:03:40 +00:00
|
|
|
/// Errors that could occur within Lofty.
|
2020-10-26 23:19:27 +00:00
|
|
|
#[derive(thiserror::Error, Debug)]
|
2021-04-03 16:19:21 +00:00
|
|
|
pub enum Error {
|
2021-04-03 15:44:33 +00:00
|
|
|
/// Unknown file extension.
|
|
|
|
#[error("Failed to guess the metadata format based on the file extension.")]
|
2021-04-14 16:17:38 +00:00
|
|
|
UnknownFileExtension,
|
2020-10-26 23:16:04 +00:00
|
|
|
|
2021-04-03 15:44:33 +00:00
|
|
|
/// Unsupported file extension
|
2021-04-03 00:47:44 +00:00
|
|
|
#[error("Unsupported format: {0}")]
|
|
|
|
UnsupportedFormat(String),
|
|
|
|
#[error("Unsupported mime type: {0}")]
|
|
|
|
UnsupportedMimeType(String),
|
2020-10-26 23:16:04 +00:00
|
|
|
|
2021-04-15 17:26:06 +00:00
|
|
|
#[error(transparent)]
|
|
|
|
ApeTag(#[from] ape::Error),
|
2021-04-03 18:31:13 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
FlacTag(#[from] metaflac::Error),
|
2021-04-03 00:47:44 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
Id3Tag(#[from] id3::Error),
|
2021-04-03 00:47:44 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
Mp4Tag(#[from] mp4ameta::Error),
|
2021-04-03 00:47:44 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
OpusTag(#[from] opus_headers::ParseError),
|
2021-04-03 00:47:44 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
Lewton(#[from] lewton::VorbisError),
|
2021-04-14 03:29:13 +00:00
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
Ogg(#[from] ogg::OggReadError),
|
2021-04-17 19:42:06 +00:00
|
|
|
#[error("{0}")]
|
|
|
|
Wav(String),
|
2020-10-26 23:16:04 +00:00
|
|
|
|
2021-04-03 15:44:33 +00:00
|
|
|
#[error("")]
|
|
|
|
NotAPicture,
|
|
|
|
|
2021-04-17 19:42:06 +00:00
|
|
|
#[error(transparent)]
|
|
|
|
Utf8(#[from] std::str::Utf8Error),
|
|
|
|
#[error(transparent)]
|
|
|
|
FromUtf8(#[from] std::string::FromUtf8Error),
|
2021-04-03 15:44:33 +00:00
|
|
|
/// Represents all cases of `std::io::Error`.
|
|
|
|
#[error(transparent)]
|
2021-04-14 16:17:38 +00:00
|
|
|
IO(#[from] std::io::Error),
|
2021-04-03 15:44:33 +00:00
|
|
|
}
|
2021-04-03 16:19:21 +00:00
|
|
|
|
2021-04-03 17:03:40 +00:00
|
|
|
/// Type alias for the result of tag operations.
|
2021-04-03 16:19:21 +00:00
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|