mirror of
https://git.zavage.net/Zavage-Software/search-with-chatgpt-powered-by-openai-extension.git
synced 2026-08-10 13:40:29 -06:00
fix: swallow rejections on the tab-open and menu-registration paths
This commit is contained in:
parent
f683f2e841
commit
22fc754636
@ -52,6 +52,7 @@ async function readSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function openChatGpt(query) {
|
async function openChatGpt(query) {
|
||||||
|
try {
|
||||||
const settings = await load();
|
const settings = await load();
|
||||||
const url = buildChatGptUrl(settings, query);
|
const url = buildChatGptUrl(settings, query);
|
||||||
|
|
||||||
@ -65,6 +66,10 @@ async function openChatGpt(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await browser.tabs.create({ url, active: settings.openIn !== "background-tab" });
|
await browser.tabs.create({ url, active: settings.openIn !== "background-tab" });
|
||||||
|
} catch {
|
||||||
|
// Silence rejections silently — the user expects either a tab to open or
|
||||||
|
// nothing, not an error log. Every failure path must degrade gracefully.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeAll() first, so a background event page waking up and re-running this
|
// removeAll() first, so a background event page waking up and re-running this
|
||||||
@ -96,4 +101,7 @@ if (browser.commands) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
registerMenu();
|
registerMenu().catch(() => {
|
||||||
|
// Silence rejections from menus.removeAll() — it cannot prevent menu creation
|
||||||
|
// on retry, so degrade gracefully with no unhandled rejection logged.
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user