add try catch to notification

This commit is contained in:
hippoz 2020-11-20 22:11:21 +02:00
parent 86ad93b318
commit 6d6c4ebb61

View file

@ -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');
}
}
}
},