fix(cartesia): stop double-yielding ErrorFrame on HTTP non-200
The non-200 branch yielded an ErrorFrame and then raised, which the outer except caught and yielded a second, less informative "Unknown error" frame. Return after the yield and fold the status code into the message.
This commit is contained in:
@@ -955,8 +955,10 @@ class CartesiaHttpTTSService(TTSService):
|
||||
async with self._session.post(url, json=payload, headers=headers) as response:
|
||||
if response.status != 200:
|
||||
error_text = await response.text()
|
||||
yield ErrorFrame(error=f"Cartesia API error: {error_text}")
|
||||
raise Exception(f"Cartesia API returned status {response.status}: {error_text}")
|
||||
yield ErrorFrame(
|
||||
error=f"Cartesia API error (status {response.status}): {error_text}"
|
||||
)
|
||||
return
|
||||
|
||||
audio_data = await response.read()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user