MCPcopy Index your code
hub / github.com/simstudioai/sim / getTtsErrorMessage

Function getTtsErrorMessage

apps/sim/app/api/tools/tts/unified/route.ts:50–65  ·  view source on GitHub ↗
(error: Record<string, unknown>, fallback: string)

Source from the content-addressed store, hash-verified

48}
49
50function getTtsErrorMessage(error: Record<string, unknown>, fallback: string): string {
51 const nested = error.error
52 if (typeof nested === 'object' && nested !== null && 'message' in nested) {
53 const message = (nested as { message?: unknown }).message
54 if (typeof message === 'string') return message
55 }
56 for (const key of ['message', 'err_msg', 'error_message', 'error', 'detail']) {
57 const value = error[key]
58 if (typeof value === 'string') return value
59 if (typeof value === 'object' && value !== null && 'message' in value) {
60 const message = (value as { message?: unknown }).message
61 if (typeof message === 'string') return message
62 }
63 }
64 return fallback
65}
66
67export const dynamic = 'force-dynamic'
68export const maxDuration = 60 // 1 minute

Callers 6

synthesizeWithOpenAiFunction · 0.85
synthesizeWithDeepgramFunction · 0.85
synthesizeWithElevenLabsFunction · 0.85
synthesizeWithCartesiaFunction · 0.85
synthesizeWithGoogleFunction · 0.85
synthesizeWithPlayHTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected