diff --git a/sync-server/src/storage/sqlite.rs b/sync-server/src/storage/sqlite.rs index a4b91134b..bfdf2a8b2 100644 --- a/sync-server/src/storage/sqlite.rs +++ b/sync-server/src/storage/sqlite.rs @@ -8,6 +8,8 @@ use std::path::Path; enum SqliteError { #[error("SQLite transaction already committted")] TransactionAlreadyCommitted, + #[error("Failed to create SQLite transaction")] + CreateTransactionFailed, } /// Newtype to allow implementing `FromSql` for foreign `uuid::Uuid` @@ -96,7 +98,10 @@ struct Txn<'t> { impl<'t> Txn<'t> { fn get_txn(&mut self) -> Result { - Ok(self.con.transaction().unwrap()) + Ok(self + .con + .transaction() + .map_err(|_e| SqliteError::CreateTransactionFailed)?) } } diff --git a/taskchampion/src/server/local.rs b/taskchampion/src/server/local.rs index 47f8e5cc3..8b5dfa9a7 100644 --- a/taskchampion/src/server/local.rs +++ b/taskchampion/src/server/local.rs @@ -50,7 +50,7 @@ pub struct LocalServer { } impl LocalServer { - fn txn<'a>(&'a mut self) -> anyhow::Result { + fn txn(&mut self) -> anyhow::Result { let txn = self.con.transaction()?; Ok(txn) }