fix(model): avoid shadowing response error
This commit is contained in:
parent
5e3fd4cd0f
commit
f53e6e68e2
1 changed files with 3 additions and 3 deletions
|
|
@ -45,9 +45,9 @@ func fetchOpenAIModels(baseURL, apiKey string) ([]modelEntry, error) {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
body, err := io.ReadAll(io.LimitReader(resp.Body, 512))
|
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 512))
|
||||||
if err != nil {
|
if readErr != nil {
|
||||||
return nil, fmt.Errorf("read error response: %w", err)
|
return nil, fmt.Errorf("read error response: %w", readErr)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
|
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue