Catch early exceptions in runCorruptionChecks

This commit is contained in:
Fedor Indutny 2023-11-15 21:39:17 +01:00 committed by GitHub
parent f6242c697c
commit a97db23afa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5216,7 +5216,16 @@ async function getAllBadgeImageFileLocalPaths(): Promise<Set<string>> {
}
function runCorruptionChecks(): void {
const db = getUnsafeWritableInstance('integrity check');
let db: Database;
try {
db = getUnsafeWritableInstance('integrity check');
} catch (error) {
logger.error(
'runCorruptionChecks: not running the check, no writable instance',
Errors.toLogFormat(error)
);
return;
}
try {
const result = db.pragma('integrity_check');
if (result.length === 1 && result.at(0)?.integrity_check === 'ok') {