Skip to content

Commit 8663926

Browse files
committed
Suppress unwanted errors
1 parent 5db21d4 commit 8663926

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/background/chrome.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function startNative() {
154154
nvimServer.instance = startNative();
155155
} else {
156156
delete nvimServer.instance;
157-
LOG("error", "Failed to connect neovim, please make sure your neovim version 0.5 or above.");
157+
LOG("warn", "Failed to connect neovim, please make sure your neovim version 0.5 or above.");
158158
}
159159
});
160160
nm.onMessage.addListener(async (resp) => {

src/background/start.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,11 @@ function start(browser) {
319319
}
320320

321321
function sendTabMessage(tabId, frameId, message, cb) {
322-
if (frameId === -1) {
323-
chrome.tabs.sendMessage(tabId, message);
324-
} else {
325-
chrome.tabs.sendMessage(tabId, message, {frameId: frameId});
322+
const opts = (frameId === -1) ? undefined : {frameId: frameId};
323+
// use catch to suppress Uncaught (in promise) Error on sending message to unsupported tabs like chrome://
324+
const p = chrome.tabs.sendMessage(tabId, message, opts);
325+
if (p) {
326+
p.catch((e) => {});
326327
}
327328
}
328329
var _lastActiveTabId = null;

0 commit comments

Comments
 (0)