mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-07-28 01:27:58 +00:00
fix(model): avoid shadowing response error
This commit is contained in:
@@ -45,9 +45,9 @@ func fetchOpenAIModels(baseURL, apiKey string) ([]modelEntry, error) {
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, err := io.ReadAll(io.LimitReader(resp.Body, 512))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read error response: %w", err)
|
||||
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 512))
|
||||
if readErr != nil {
|
||||
return nil, fmt.Errorf("read error response: %w", readErr)
|
||||
}
|
||||
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user