diff --git a/desktop/flow-typed/npm/electron_v22.0.0.js b/desktop/flow-typed/npm/electron_v22.0.0.js --- a/desktop/flow-typed/npm/electron_v22.0.0.js +++ b/desktop/flow-typed/npm/electron_v22.0.0.js @@ -391,6 +391,11 @@ senderId: number, ports: $ReadOnlyArray, }; + + declare export var dialog: Dialog; + declare class Dialog { + showErrorBox(title: string, content: string): void; + } } declare module 'electron/main' { @@ -402,6 +407,7 @@ ipcMain, systemPreferences, autoUpdater, + dialog, } from 'electron'; } diff --git a/desktop/src/main.js b/desktop/src/main.js --- a/desktop/src/main.js +++ b/desktop/src/main.js @@ -8,6 +8,7 @@ ipcMain, systemPreferences, autoUpdater, + dialog, // eslint-disable-next-line import/extensions } from 'electron/main'; import fs from 'fs'; @@ -286,3 +287,13 @@ } else { run(); } + +process.on('uncaughtException', (error: Error) => { + if (error.message === 'The internet connection appears to be offline.') { + return; + } + dialog.showErrorBox( + 'A JavaScript error occurred in the main process', + `Uncaught Exception: ${error.name}: ${error.message}`, + ); +});