This is just me finding a few more edge cases after #34156 and #34176
The goal of the PR is to handle failures in a controlled way. Just so the process can automatically restore the original wallet without requiring user manual intervention.
The covered cases are:
-
During
DoMigration(): There are methods that can throw exceptions and abruptly abort the process. Instead of crashing (GUI) or returning a generic exception, we now will catch and return the error gracefully. This lets the process restore the original wallet automatically. -
Trying to migrate a wallet in a read-only directory throws a filesystem exception and skips cleanup. Now the process will fail gracefully with a clear error msg, and automatically restore the original wallet.
-
Any failure during
MigrateToSQLiterequires user manual intervention. Now the original wallet db will remain untouched, and only be updated once the sqlite db creation fully succeeds.