Skip to content

Commit 2f10507

Browse files
committed
ci: print Gemini API error bodies in the docs translation script
A 400 response is discarded by file_get_contents without ignore_errors, leaving the status line as the only clue.
1 parent 65b8abb commit 2f10507

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎docs/translate.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function makeGeminiRequest(string $systemPrompt, string $userPrompt, string $mod
5050
'header' => "Content-Type: application/json\r\nX-Goog-Api-Key: $apiKey\r\nContent-Length: " . strlen($body) . "\r\n",
5151
'content' => $body,
5252
'timeout' => 300,
53+
// keep the response body on 4xx/5xx, the API error message is the only usable diagnostic
54+
'ignore_errors' => true,
5355
]
5456
]));
5557
$generatedDocs = json_decode($response, true)['candidates'][0]['content']['parts'][0]['text'] ?? '';

0 commit comments

Comments
 (0)