From 1b6cd3d16bf6ff4c3852dcc5a76392befda5eee0 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Thu, 30 Jun 2022 12:00:40 -0700 Subject: [PATCH] Handle render-process-gone --- app/global_errors.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/global_errors.ts b/app/global_errors.ts index bc79d6298..ca8afe174 100644 --- a/app/global_errors.ts +++ b/app/global_errors.ts @@ -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)); });