diff --git a/src/imex.rs b/src/imex.rs index 93bb958de..60ec4740d 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -123,7 +123,7 @@ async fn cleanup_aborted_imex(context: &Context, what: ImexMode) { .sql .open(context, context.get_dbfile(), false) .await - .ok(); + .map_err(|e| warn!(context, "Re-opening db after imex failed: {}", e)); } } @@ -171,17 +171,23 @@ pub async fn has_backup_old(context: &Context, dir_name: impl AsRef) -> Re let name = name.to_string_lossy(); if name.starts_with("delta-chat") && name.ends_with(".bak") { let sql = Sql::new(); - if sql.open(context, &path, true).await.is_ok() { - let curr_backup_time = sql - .get_raw_config_int(context, "backup_time") - .await - .unwrap_or_default(); - if curr_backup_time > newest_backup_time { - newest_backup_path = Some(path); - newest_backup_time = curr_backup_time; + match sql.open(context, &path, true).await { + Ok(_) => { + let curr_backup_time = sql + .get_raw_config_int(context, "backup_time") + .await + .unwrap_or_default(); + if curr_backup_time > newest_backup_time { + newest_backup_path = Some(path); + newest_backup_time = curr_backup_time; + } + info!(context, "backup_time of {} is {}", name, curr_backup_time); + sql.close().await; } - info!(context, "backup_time of {} is {}", name, curr_backup_time); - sql.close().await; + Err(e) => warn!( + context, + "Found backup file {} which could not be opened: {}", name, e + ), } } } diff --git a/src/sql.rs b/src/sql.rs index e5105b39b..137155125 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -78,7 +78,6 @@ impl Sql { // drop closes the connection } - // return true on success, false on failure pub async fn open>( &self, context: &Context,