From a97db23afaffe3408b38ef16ea789aa501b1c16d Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:39:17 +0100 Subject: [PATCH] Catch early exceptions in runCorruptionChecks --- ts/sql/Server.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index 641292763..3a60011a3 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -5216,7 +5216,16 @@ async function getAllBadgeImageFileLocalPaths(): Promise> { } 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') {