From b223d3b3856cea0c799ffd1bc904a6048bfd71e2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 7 Nov 2016 14:37:12 +0000 Subject: [PATCH] Catch unhandled errors in the electron process Otherwise we pop up stack traces in dialog boxes if it fails to to poll for updates or something. --- electron/src/electron-main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 09ae5729e8..a6e5a7766e 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -91,6 +91,16 @@ function pollForUpdates() { } } +// handle uncaught errors otherwise it displays +// stack traces in popup dialogs, which is terrible (which +// it will do any time the auto update poke fails, and there's +// no other way to catch this error). +// Assuming we generally run from the console when developing, +// this is far preferable. +process.on('uncaughtException', function (error) { + console.log("Unhandled exception", error); +}); + electron.ipcMain.on('install_update', installUpdate); electron.app.on('ready', () => {