aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-28 17:43:52 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-28 17:43:52 +0900
commitee0f7b5806c8e28e3a7dc002e9dde467d1fa2a9b (patch)
treec45544f08fed37a47dfc7684bc8ecbabeeadf951
parent8c52d89e0029ed19c379d459f4a8226e94211eb4 (diff)
Catch errors on background
-rw-r--r--src/background/infrastructures/content-message-listener.js6
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,
});
- }
+ });
});
}