Page MenuHomePhabricator

D6684.diff
No OneTemporary

D6684.diff

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<MessagePort>,
};
+
+ 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}`,
+ );
+});

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 10:57 AM (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694516
Default Alt Text
D6684.diff (1 KB)

Event Timeline