Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(dictation): fall back to the Cloud upload when the Orukeet session request times out (#2422)
void43c0d28bf0cd
diff --git a/src/helpers/policyResponseError.js b/src/helpers/policyResponseError.jsindex 4107f9040..8d3a0ea4b 100644--- a/src/helpers/policyResponseError.js+++ b/src/helpers/policyResponseError.js@@ -30,7 +30,9 @@ function toPolicyFailure(error) {return {success: false,error: error?.message || String(error),- ...(error?.code ? { code: error.code } : {}),+ // A DOMException's legacy numeric code (a fetch timeout's is 23) is not an+ // error code; renderers match codes as strings.+ ...(typeof error?.code === "string" && error.code ? { code: error.code } : {}),...(Number.isInteger(error?.status) ? { status: error.status } : {}),...(error?.minAppVersion ? { minAppVersion: error.minAppVersion } : {}),...(error?.details !== undefined ? { details: error.details } : {}),diff --git a/test/helpers/policyResponseError.test.js b/test/helpers/policyResponseError.test.jsindex 5077bc97b..3985cb8f8 100644--- a/test/helpers/policyResponseError.test.js+++ b/test/helpers/policyResponseError.test.js@@ -33,6 +33,16 @@ test("preserves policy denial code, status, details, and minimum version", async}});+test("drops a DOMException's numeric code, which is not an error code", () => {+ const timeout = new DOMException("The operation was aborted due to timeout", "TimeoutError");+ assert.equal(timeout.code, 23);++ assert.deepEqual(toPolicyFailure(timeout), {+ success: false,+ error: "The operation was aborted due to timeout",+ });+});+test("normalizes parsed multipart policy errors without losing legacy statusCode", () => {const error = createPolicyResponseError(426,diff --git a/test/helpers/transcriptionFallback.test.js b/test/helpers/transcriptionFallback.test.jsindex bce5120ca..1cbe86089 100644--- a/test/helpers/transcriptionFallback.test.js+++ b/test/helpers/transcriptionFallback.test.js@@ -93,9 +93,10 @@ test("an unavailable session service falls back to batch as session_unavailable"test("a start that fails without a denial to act on falls back instead of losing the dictation", async () => {const failures = [- // Network error or the 10 s session request timeout.+ // Network error.{ success: false, code: "NETWORK_ERROR" },- { success: false, error: "The operation was aborted due to timeout" },+ // The 10 s session request timeout, as it crosses IPC.+ toPolicyFailure(new DOMException("The operation was aborted due to timeout", "TimeoutError")),// WebSocket handshake failure or a rejected session body.{ success: false, error: "Orukeet connection closed before completion" },{ success: false, error: "Invalid Orukeet cloud session" },