From 6d6c4ebb61a250b6306d8215dfd11be59708b0cc Mon Sep 17 00:00:00 2001 From: hippoz Date: Fri, 20 Nov 2020 22:11:21 +0200 Subject: [PATCH] add try catch to notification --- app/resources/js/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/resources/js/app.js b/app/resources/js/app.js index 8fc6d52..1b81427 100755 --- a/app/resources/js/app.js +++ b/app/resources/js/app.js @@ -245,9 +245,14 @@ const app = new Vue({ if (messageObject.author.username !== this.loggedInUser.username) { if (Notification.permission === 'granted') { - new Notification(`${messageObject.category.title}/${messageObject.author.username}`, { - body: messageObject.content - }); + try { + new Notification(`${messageObject.category.title}/${messageObject.author.username}`, { + body: messageObject.content + }); + } catch(e) { + console.log('[E] [chat] Failed to show notification'); + } + } } },