Compare commits

...
Author SHA1 Message Date
Cursor Agent aac6796d8c Wrap migration ROLLBACK in try/catch to preserve original error
Match the pattern used in StateDb.transaction: if ROLLBACK itself
throws (e.g. bad DB connection state), the original migration error
is still re-thrown instead of being replaced by the rollback error.
2026-02-20 09:10:36 +00:00
+5 -1
View File
@@ -90,7 +90,11 @@ export function runStateMigrations(db: SqliteDatabase): void {
db.exec(`PRAGMA user_version=${STATE_DB_SCHEMA_VERSION};`);
db.exec("COMMIT;");
} catch (error) {
db.exec("ROLLBACK;");
try {
db.exec("ROLLBACK;");
} catch {
// Preserve the original migration error if rollback also throws.
}
throw error;
}
}