From 02e85fcffb40560d0c672c30a07c874200b954cb Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 27 Oct 2016 10:16:05 +0100 Subject: [PATCH] Catch electron exception --- src/vector/platform/ElectronPlatform.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index d02b04321d..0c3852ef1f 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -37,9 +37,18 @@ if (window && window.process && window.process && window.process.type === 'rende } export default class ElectronPlatform extends BasePlatform { - setNotificationCount(count: number) { - super.setNotificationCount(count); - remote.app.setBadgeCount(count); + // this sometimes throws because electron is made of fail: + // https://github.com/electron/electron/issues/7351 + // For now, let's catch the error, but I suspect it may + // continue to fail and we might just have to accept that + // electron's remote RPC is a non-starter for now and use IPC + try { + setNotificationCount(count: number) { + super.setNotificationCount(count); + remote.app.setBadgeCount(count); + } + } catch (e) { + console.error("Failed to set notification count", e); } displayNotification(title: string, msg: string, avatarUrl: string): Notification {