Better reporting for DB corruption errors
This commit is contained in:
parent
092c2fd0d7
commit
1b1ed2cd05
7 changed files with 43 additions and 5 deletions
|
@ -19,10 +19,17 @@ 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: error ? error.stack : undefined,
|
||||
error: errorMessage,
|
||||
response,
|
||||
};
|
||||
port.postMessage(wrappedResponse);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue