Catch errors on background

jh-changes
Shin'ya Ueoka 6 years ago
parent 8c52d89e00
commit ee0f7b5806
  1. 6
      src/background/infrastructures/content-message-listener.js

@ -18,14 +18,12 @@ export default class ContentMessageListener {
run() { run() {
browser.runtime.onMessage.addListener((message, sender) => { 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, { return browser.tabs.sendMessage(sender.tab.id, {
type: messages.CONSOLE_SHOW_ERROR, type: messages.CONSOLE_SHOW_ERROR,
text: e.message, text: e.message,
}); });
} });
}); });
} }