Skip to content

Commit 02e85fc

Browse files
committed
Catch electron exception
1 parent fac539c commit 02e85fc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/vector/platform/ElectronPlatform.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@ if (window && window.process && window.process && window.process.type === 'rende
3737
}
3838

3939
export default class ElectronPlatform extends BasePlatform {
40-
setNotificationCount(count: number) {
41-
super.setNotificationCount(count);
42-
remote.app.setBadgeCount(count);
40+
// this sometimes throws because electron is made of fail:
41+
// https://github.com/electron/electron/issues/7351
42+
// For now, let's catch the error, but I suspect it may
43+
// continue to fail and we might just have to accept that
44+
// electron's remote RPC is a non-starter for now and use IPC
45+
try {
46+
setNotificationCount(count: number) {
47+
super.setNotificationCount(count);
48+
remote.app.setBadgeCount(count);
49+
}
50+
} catch (e) {
51+
console.error("Failed to set notification count", e);
4352
}
4453

4554
displayNotification(title: string, msg: string, avatarUrl: string): Notification {

0 commit comments

Comments
 (0)