Better reporting for DB corruption errors

This commit is contained in:
Fedor Indutny 2021-10-21 13:13:33 -07:00 committed by GitHub
parent 092c2fd0d7
commit 1b1ed2cd05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 5 deletions

View file

@ -276,6 +276,7 @@ const dataInterface: ServerInterface = {
// Server-only
getCorruptionLog,
initialize,
initializeRenderer,
@ -2695,6 +2696,19 @@ let globalInstanceRenderer: Database | undefined;
let databaseFilePath: string | undefined;
let indexedDBPath: string | undefined;
let corruptionLog = new Array<string>();
SQL.setCorruptionLogger(line => {
logger.error(`SQL corruption: ${line}`);
corruptionLog.push(line);
});
function getCorruptionLog(): string {
const result = corruptionLog.join('\n');
corruptionLog = [];
return result;
}
async function initialize({
configDir,
key,