mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 21:42:26 +00:00
store_sqlite: Implement put_object overwrite parameter
This commit is contained in:
@@ -11,6 +11,13 @@ impl From<sqlx::Error> for Error {
|
||||
fn from(value: sqlx::Error) -> Self {
|
||||
match value {
|
||||
sqlx::Error::RowNotFound => Error::StoreError(rustical_store::Error::NotFound),
|
||||
sqlx::Error::Database(err) => {
|
||||
if err.is_unique_violation() {
|
||||
Error::StoreError(rustical_store::Error::AlreadyExists)
|
||||
} else {
|
||||
Error::SqlxError(sqlx::Error::Database(err))
|
||||
}
|
||||
}
|
||||
err => Error::SqlxError(err),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user