Handle render-process-gone

This commit is contained in:
Fedor Indutny 2022-06-30 12:00:40 -07:00 committed by GitHub
parent d87dceced9
commit 1b6cd3d16b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -54,6 +54,19 @@ function _getError(reason: unknown): Error {
}
export const addHandler = (): void => {
app.on('render-process-gone', (_event, _webContents, details) => {
const { reason, exitCode } = details;
if (reason === 'clean-exit') {
return;
}
handleError(
'Render process is gone',
new Error(`Reason: ${reason}, Exit Code: ${exitCode}`)
);
});
process.on('uncaughtException', (reason: unknown) => {
handleError('Unhandled Error', _getError(reason));
});