31 lines
636 B
Rust
31 lines
636 B
Rust
use shanty_db::DbError;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum TagError {
|
|
#[error("database error: {0}")]
|
|
Db(#[from] DbError),
|
|
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("HTTP error: {0}")]
|
|
Http(#[from] reqwest::Error),
|
|
|
|
#[error("metadata error: {0}")]
|
|
Metadata(String),
|
|
|
|
#[error("no match found for track {0}")]
|
|
NoMatch(i32),
|
|
|
|
#[error("{0}")]
|
|
Other(String),
|
|
}
|
|
|
|
impl From<lofty::error::LoftyError> for TagError {
|
|
fn from(e: lofty::error::LoftyError) -> Self {
|
|
TagError::Metadata(e.to_string())
|
|
}
|
|
}
|
|
|
|
pub type TagResult<T> = Result<T, TagError>;
|