store, store_sqlite: Refactor error typing

This commit is contained in:
Lennart
2024-10-28 17:10:03 +01:00
parent 925b26ea0f
commit cce3e260af
9 changed files with 75 additions and 106 deletions

View File

@@ -26,7 +26,7 @@ impl SqliteStore {
}
}
pub async fn create_db_pool(db_url: &str, migrate: bool) -> anyhow::Result<Pool<Sqlite>> {
pub async fn create_db_pool(db_url: &str, migrate: bool) -> Result<Pool<Sqlite>, sqlx::Error> {
let db = SqlitePool::connect_with(
SqliteConnectOptions::new()
.filename(db_url)
@@ -40,7 +40,7 @@ pub async fn create_db_pool(db_url: &str, migrate: bool) -> anyhow::Result<Pool<
Ok(db)
}
pub async fn create_test_store() -> anyhow::Result<SqliteStore> {
pub async fn create_test_store() -> Result<SqliteStore, sqlx::Error> {
let db = SqlitePool::connect("sqlite::memory:").await?;
sqlx::migrate!("./migrations").run(&db).await?;
Ok(SqliteStore::new(db))