aboutsummaryrefslogtreecommitdiff
path: root/src/background/infrastructures/content-message-listener.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/infrastructures/content-message-listener.js')
-rw-r--r--src/background/infrastructures/content-message-listener.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js
index 2fa5f54..58716fb 100644
--- a/src/background/infrastructures/content-message-listener.js
+++ b/src/background/infrastructures/content-message-listener.js
@@ -18,12 +18,19 @@ export default class ContentMessageListener {
run() {
browser.runtime.onMessage.addListener((message, sender) => {
- return this.onMessage(message, sender).catch((e) => {
+ try {
+ return this.onMessage(message, sender).catch((e) => {
+ return browser.tabs.sendMessage(sender.tab.id, {
+ type: messages.CONSOLE_SHOW_ERROR,
+ text: e.message,
+ });
+ });
+ } catch (e) {
return browser.tabs.sendMessage(sender.tab.id, {
type: messages.CONSOLE_SHOW_ERROR,
text: e.message,
});
- });
+ }
});
}