chore: add derive_more and smart-default crates
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -24,11 +24,24 @@ pub enum CoreError {
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
impl From<rusqlite_migration::Error> for CoreError {
|
||||
fn from(err: rusqlite_migration::Error) -> Self {
|
||||
match err {
|
||||
rusqlite_migration::Error::RusqliteError { err: e, .. } => CoreError::Database(e),
|
||||
e => CoreError::Other(e.into()),
|
||||
}
|
||||
}
|
||||
use derive_more::From;
|
||||
|
||||
#[derive(Error, Debug, From)]
|
||||
pub enum CoreError {
|
||||
#[error("Database error: {0}")]
|
||||
Database(#[from] rusqlite::Error),
|
||||
#[error("I/O error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("Item not found with id {0}")]
|
||||
ItemNotFound(i64),
|
||||
#[error("Item not found")]
|
||||
ItemNotFoundGeneric,
|
||||
#[error("Invalid input: {0}")]
|
||||
InvalidInput(String),
|
||||
#[error("Compression error: {0}")]
|
||||
Compression(String),
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
#[from]
|
||||
Migration(#[error(ignore)] rusqlite_migration::Error),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user