#1515 sendMessageToAllFrames - handle error

This commit is contained in:
GrzegorzZajac000 2024-03-22 14:15:55 +01:00
parent 56f559283b
commit eb5139671b

View File

@ -18,6 +18,8 @@
// //
const browser = require('webextension-polyfill'); const browser = require('webextension-polyfill');
const config = require('../../config');
const TwoFasNotification = require('../notification');
const sendMessageToAllFrames = async (tabId, message) => { const sendMessageToAllFrames = async (tabId, message) => {
const frames = await browser.webNavigation.getAllFrames({ tabId }); const frames = await browser.webNavigation.getAllFrames({ tabId });
@ -41,8 +43,9 @@ const sendMessageToAllFrames = async (tabId, message) => {
} }
}); });
}).catch(err => { }).catch(err => {
// @TODO: catch err if (err.toString().includes('Receiving end does not exist')) {
console.error(err); return TwoFasNotification.show(config.Texts.Error.LackOfTab, tabId);
}
}); });
}; };