fix(history-db): treat SQLITE_CANTOPEN as readonly WAL retry error

- Add `sqlite_cantopen` and `unable to open database file` to `isReadonlyWalRetryError` checks
- Cover `SQLITE_CANTOPEN` case in test
This commit is contained in:
2026-07-05 01:18:41 -07:00
parent 651e541ea8
commit 2f16df8d17
2 changed files with 12 additions and 1 deletions
+9
View File
@@ -300,6 +300,15 @@ test('isReadonlyWalRetryError only accepts readonly errors from WAL-mode databas
),
true,
);
assert.equal(
isReadonlyWalRetryError(
Object.assign(new Error('unable to open database file'), {
code: 'SQLITE_CANTOPEN',
}),
walDbPath,
),
true,
);
assert.equal(
isReadonlyWalRetryError(new Error('no such table: imm_sessions'), walDbPath),
false,