Initial commit
This commit is contained in:
30
src/error.rs
Normal file
30
src/error.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
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>;
|
||||
Reference in New Issue
Block a user