add better res

This commit is contained in:
unintendedfraud
2025-12-25 18:35:52 +01:00
parent ebdd44e7ab
commit c7a9c78ea3
2 changed files with 13 additions and 2 deletions
+3 -2
View File
@@ -50,11 +50,12 @@ func (client Client) GenerateContent(message string) (string, error) {
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if res.StatusCode != 200 {
return "", fmt.Errorf("LLM returned status code: [%d]", res.StatusCode)
return "", fmt.Errorf("LLM returned status code [%d]: %s", res.StatusCode, string(body))
}
body, err := io.ReadAll(res.Body)
if err != nil {
return "", fmt.Errorf("failed to read the llm response body: %w", err)
}