From 4bd2084ba7b23327c26a2d8b24dc4169c14bfa17 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 28 Jul 2018 19:41:07 +0900 Subject: Error on console --- src/background/infrastructures/content-message-listener.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/background/infrastructures') 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, }); - }); + } }); } -- cgit v1.2.3