Include new database corruption check for SQL errors

This commit is contained in:
Scott Nonnenberg 2021-06-30 15:06:50 -07:00 committed by GitHub
parent 759ced3417
commit 3b444479c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -415,9 +415,14 @@ function _updateJob(id: number, data: ClientJobUpdateType) {
`SQL channel job ${id} (${fnName}) failed in ${end - start}ms`
);
if (error && error.message && error.message.includes('SQLITE_CORRUPT')) {
if (
error &&
error.message &&
(error.message.includes('SQLITE_CORRUPT') ||
error.message.includes('database disk image is malformed'))
) {
window.log.error(
'Detected SQLITE_CORRUPT error; restarting the application immediately'
`Detected corruption. Restarting the application immediately. Error: ${error.message}`
);
window.restart();
}