Add an error handler for content script injection

This commit is contained in:
Will Bamberg
2017-07-06 21:19:56 -07:00
parent 273c3c5690
commit 5113f85fe7

View File

@@ -58,10 +58,15 @@ document.addEventListener("click", (e) => {
});
}
function reportError(error) {
console.error(`Could not inject content script: ${error}`);
}
if (e.target.classList.contains("beast")) {
injectTestScript()
.then(injectBeastify)
.then(messageBeastify);
.then(messageBeastify)
.catch(reportError);
}
else if (e.target.classList.contains("clear")) {
browser.tabs.reload();