π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(voice): answer host requests that throw instead of dangling the channel
Luis Ortiz6471c52a9487
diff --git a/src/lib/offscreen.ts b/src/lib/offscreen.tsindex e8537c3..1060d1a 100644--- a/src/lib/offscreen.ts+++ b/src/lib/offscreen.ts@@ -177,8 +177,10 @@ export function registerVoicePanelRelay(): void {}async function answered<T>(message: VoiceRequest, missing: T): Promise<T> {- if (!IS_FIREFOX) return request<T>(message);- const response = await request<T | undefined>(message).catch(() => undefined);+ const response = await request<T | undefined>(message).catch((error: unknown) => {+ logger.warn('voice: the microphone host did not answer', message.type, error);+ return undefined;+ });return response ?? missing;}diff --git a/src/lib/voice-host.ts b/src/lib/voice-host.tsindex 3d7cf53..b7af3c2 100644--- a/src/lib/voice-host.ts+++ b/src/lib/voice-host.ts@@ -236,7 +236,13 @@ export function startVoiceHost(): VoiceHost {onMessage((message, _sender, sendResponse) => {if (!isVoiceMessageFor(VOICE_OFFSCREEN_TARGET, message)) return undefined;- void host.handle(message as VoiceRequest).then(sendResponse);+ host+ .handle(message as VoiceRequest)+ .then(sendResponse)+ .catch((error: unknown) => {+ logger.error('voice: host could not handle request', message, error);+ sendResponse({ ok: false, started: false, reason: 'unknown', error: String(error) });+ });return true;});