Generates sanitized CORS error responses for upstream failures in audio/speech endpoints.
// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Shared audio/speech HTTP response helpers.
*
* Extracted from `open-sse/handlers/audioSpeech.ts` so that both the handler
* and any provider-specific adapter modules extracted alongside it (e.g.
* `open-sse/executors/awsPollyTts.ts`) can share the same response-shaping
* logic without importing from the (frozen, file-size-ratcheted) handler
* itself — which would create a circular import.
*/
import { CORS_HEADERS } from "./cors.ts";
import { errorResponse } from "./error.ts";
import { sanitizeErrorMessage } from "./errorSanitization.ts";
/**
* Pull a human-readable error message out of a parsed upstream JSON error
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key