Moved error handling to one function

This commit is contained in:
2024-04-29 13:40:31 +03:00
parent ff1d5a039d
commit 4ac34a73bb
12 changed files with 41 additions and 24 deletions

View File

@@ -1,5 +1,4 @@
use crate::prelude::*;
use log::error;
/// Gets the master password, deletes the accounts and the master password from DB.
/// Although it doesn't use the master password, we get it to be sure that it's the user who used that command
@@ -27,8 +26,10 @@ async fn get_master_pass(
&locale.everything_was_deleted
}
(Err(err), _) | (_, Err(err)) => {
error!("{:?}", crate::Error::from(err));
txn.rollback().await?;
handle_error(err);
if let Err(err) = txn.rollback().await {
handle_error(err);
}
&locale.something_went_wrong
}
};