From 0f33fcc2bcc644585f04e801cfa59b1681edb66e Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Wed, 15 Nov 2023 13:36:17 -0800 Subject: [PATCH] Catch early exceptions in runCorruptionChecks Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> --- 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 6412927637..3a60011a33 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') {