Merge pull request #3124 from chengzhichao-xydt/codex/tts-readall-error

fix(tts): handle io.ReadAll error in error response path
This commit is contained in:
Mauro 2026-06-14 21:22:01 +02:00 committed by GitHub
commit 7b2e0ccfc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -196,7 +196,10 @@ func (t *OpenAITTSProvider) doSpeechRequest(
if resp.StatusCode != http.StatusOK {
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
body, readErr := io.ReadAll(resp.Body)
if readErr != nil {
body = []byte(fmt.Sprintf("(failed to read error body: %v)", readErr))
}
return nil, &openAITTSAPIError{
statusCode: resp.StatusCode,
body: string(body),