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:
@@ -12,6 +12,8 @@ categories = ["command-line-utilities"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.72"
|
anyhow = "1.0.72"
|
||||||
axum = "0.8.4"
|
axum = "0.8.4"
|
||||||
|
derive_more = "1.0"
|
||||||
|
smart-default = "0.7"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
clap = { version = "4.3.10", features = ["derive", "env"] }
|
clap = { version = "4.3.10", features = ["derive", "env"] }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub fn mode_info(
|
|||||||
show_item(item_with_meta, settings, data_path)
|
show_item(item_with_meta, settings, data_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
struct ItemInfo {
|
struct ItemInfo {
|
||||||
id: i64,
|
id: i64,
|
||||||
timestamp: String,
|
timestamp: String,
|
||||||
|
|||||||
@@ -24,11 +24,24 @@ pub enum CoreError {
|
|||||||
Other(#[from] anyhow::Error),
|
Other(#[from] anyhow::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<rusqlite_migration::Error> for CoreError {
|
use derive_more::From;
|
||||||
fn from(err: rusqlite_migration::Error) -> Self {
|
|
||||||
match err {
|
#[derive(Error, Debug, From)]
|
||||||
rusqlite_migration::Error::RusqliteError { err: e, .. } => CoreError::Database(e),
|
pub enum CoreError {
|
||||||
e => CoreError::Other(e.into()),
|
#[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