Update better-sqlite3
This commit is contained in:
parent
b96b02593b
commit
a15d84aade
7 changed files with 13 additions and 48 deletions
|
@ -592,10 +592,7 @@ function makeChannel(fnName: string) {
|
|||
'Detected sql corruption in renderer process. ' +
|
||||
`Restarting the application immediately. Error: ${error.message}`
|
||||
);
|
||||
ipc?.send(
|
||||
'database-error',
|
||||
`${error.stack}\n${Server.getCorruptionLog()}`
|
||||
);
|
||||
ipc?.send('database-error', error.stack);
|
||||
}
|
||||
log.error(
|
||||
`Renderer SQL channel job (${fnName}) error ${error.message}`
|
||||
|
|
|
@ -644,7 +644,6 @@ export type ServerInterface = DataInterface & {
|
|||
|
||||
// Server-only
|
||||
|
||||
getCorruptionLog: () => string;
|
||||
initialize: (options: {
|
||||
configDir: string;
|
||||
key: string;
|
||||
|
|
|
@ -315,7 +315,6 @@ const dataInterface: ServerInterface = {
|
|||
|
||||
// Server-only
|
||||
|
||||
getCorruptionLog,
|
||||
initialize,
|
||||
initializeRenderer,
|
||||
|
||||
|
@ -468,19 +467,6 @@ 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,
|
||||
|
|
|
@ -19,17 +19,10 @@ const port = parentPort;
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function respond(seq: number, error: Error | undefined, response?: any) {
|
||||
const corruptionLog = db.getCorruptionLog();
|
||||
|
||||
const errorMessage = [
|
||||
...(error ? [error.stack] : []),
|
||||
...(corruptionLog ? [corruptionLog] : []),
|
||||
].join('\n');
|
||||
|
||||
const wrappedResponse: WrappedWorkerResponse = {
|
||||
type: 'response',
|
||||
seq,
|
||||
error: errorMessage,
|
||||
error: error?.stack,
|
||||
response,
|
||||
};
|
||||
port.postMessage(wrappedResponse);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue