diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-28 17:43:52 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-28 17:43:52 +0900 |
commit | ee0f7b5806c8e28e3a7dc002e9dde467d1fa2a9b (patch) | |
tree | c45544f08fed37a47dfc7684bc8ecbabeeadf951 /src/background/infrastructures | |
parent | 8c52d89e0029ed19c379d459f4a8226e94211eb4 (diff) |
Catch errors on background
Diffstat (limited to 'src/background/infrastructures')
-rw-r--r-- | src/background/infrastructures/content-message-listener.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js index 277d108..2fa5f54 100644 --- a/src/background/infrastructures/content-message-listener.js +++ b/src/background/infrastructures/content-message-listener.js @@ -18,14 +18,12 @@ export default class ContentMessageListener { run() { browser.runtime.onMessage.addListener((message, sender) => { - try { - return this.onMessage(message, sender); - } catch (e) { + return this.onMessage(message, sender).catch((e) => { return browser.tabs.sendMessage(sender.tab.id, { type: messages.CONSOLE_SHOW_ERROR, text: e.message, }); - } + }); }); } |