Return status=500 if no audio data returned by synthesis api

This commit is contained in:
Hongbo Wu 2022-12-01 11:42:36 +08:00
parent 7c8b057f85
commit a729caa458

View file

@ -322,7 +322,7 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
}
// synthesize text to speech if cache miss
const { audioData, speechMarks } = await synthesizeTextToSpeech(input)
if (!audioData) {
if (!audioData || audioData.length === 0) {
return res.status(500).send({ errorCode: 'SYNTHESIZER_ERROR' })
}