From 4a56c76901a62a4d6729ecea163a4007eb30a8c0 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 20 Feb 2018 18:07:31 +0000 Subject: [PATCH] Electron: Fixes #247: Unreadable error messages when checking for updates --- ElectronClient/app/checkForUpdates.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/checkForUpdates.js b/ElectronClient/app/checkForUpdates.js index af1687af1..ef5eb3692 100644 --- a/ElectronClient/app/checkForUpdates.js +++ b/ElectronClient/app/checkForUpdates.js @@ -46,7 +46,13 @@ function onCheckEnded() { autoUpdater.on('error', (error) => { autoUpdateLogger_.error(error); if (checkInBackground_) return onCheckEnded(); - showErrorMessageBox(error == null ? "unknown" : (error.stack || error).toString()) + + let msg = error == null ? "unknown" : (error.stack || error).toString(); + // Error messages can be very long even without stack trace so shorten + // then so that the dialog box doesn't take the whole screen. + msg = msg.substr(0,512).replace(/\\n/g, '\n'); + showErrorMessageBox(msg) + onCheckEnded(); })