Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Add try catch + logs for debugging in FaceMLDataDB

ashilknd413c4f4c117
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart
index c1b96767e9..b00d56650c 100644
--- a/mobile/lib/face/db.dart
+++ b/mobile/lib/face/db.dart
@@ -59,7 +59,13 @@ class FaceMLDataDB {
_logger.info("Opening sqlite_async access: DB path " + databaseDirectory);
final asyncDBConnection =
SqliteDatabase(path: databaseDirectory, maxReaders: 2);
+ final stopwatch = Stopwatch()..start();
+ _logger.info("FaceMLDataDB: Starting migration");
await _migrate(asyncDBConnection);
+ _logger.info(
+ "FaceMLDataDB Migration took ${stopwatch.elapsedMilliseconds} ms",
+ );
+ stopwatch.stop();
return asyncDBConnection;
}
@@ -75,7 +81,12 @@ class FaceMLDataDB {
_logger.info("Migrating database from $currentVersion to $toVersion");
await database.writeTransaction((tx) async {
for (int i = currentVersion + 1; i <= toVersion; i++) {
- await tx.execute(_migrationScripts[i - 1]);
+ try {
+ await tx.execute(_migrationScripts[i - 1]);
+ } catch (e) {
+ _logger.severe("Error running migration script index ${i - 1}", e);
+ rethrow;
+ }
}
await tx.execute('PRAGMA user_version = $toVersion');
});