You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Medium] Audio capture preload onstop handler has no .catch (unhandled rejection) #15
Medium — unhandled promise rejection on the audio stop path.
Location
electron/audio/capture-preload.cjs:119–143 — the MediaRecorderonstop handler performs async work (finalizing/flushing the segment) but is not wrapped in try/catch and its returned promise has no .catch.
Mechanism
If the finalize/flush inside onstop throws or rejects, the rejection is unhandled. Depending on renderer/preload settings this surfaces as an unhandledRejection and the failure is silently lost rather than surfaced to the controller.
Impact
A failed final audio segment can be dropped without the user or the recorder controller being told, yielding a session with silently missing narration.
Suggested fix
Wrap the onstop body in try/catch (or attach .catch) and post an explicit error back over IPC so the controller can mark the audio segment failed.
Regression test to add (npm test)
This lives in preload (.cjs) so it's awkward to unit test directly; extract the finalize logic into a testable function and assert it reports (rather than swallows) a thrown error. If left in preload, cover via a targeted integration check. Not an evals/ concern.
Activity
fix(audio): handle rejected capture stop flush