From f914d76ce8fecb74bbddb673595c32000d0fa78f Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 28 Jul 2018 22:51:58 +0900 Subject: Fix error on keyword not found --- src/background/infrastructures/content-message-listener.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/background/infrastructures/content-message-listener.js') diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js index 58716fb..4fcc6a6 100644 --- a/src/background/infrastructures/content-message-listener.js +++ b/src/background/infrastructures/content-message-listener.js @@ -19,7 +19,11 @@ export default class ContentMessageListener { run() { browser.runtime.onMessage.addListener((message, sender) => { try { - return this.onMessage(message, sender).catch((e) => { + let ret = this.onMessage(message, sender); + if (!(ret instanceof Promise)) { + return {}; + } + return ret.catch((e) => { return browser.tabs.sendMessage(sender.tab.id, { type: messages.CONSOLE_SHOW_ERROR, text: e.message, -- cgit v1.2.3