(error: Record<string, unknown>, fallback: string)
| 48 | } |
| 49 | |
| 50 | function 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 | |
| 67 | export const dynamic = 'force-dynamic' |
| 68 | export const maxDuration = 60 // 1 minute |
no outgoing calls
no test coverage detected