mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-02 11:39:24 +01:00
Add explicit handling for 429 error code from OpenAI
This commit is contained in:
parent
fc4eb6eb6b
commit
ae14d5dd7a
@ -97,6 +97,9 @@ func GetAiSuggestionsViaOpenAiApi(query, shellName, osName string, numberComplet
|
||||
if err != nil {
|
||||
return nil, OpenAiUsage{}, fmt.Errorf("failed to read OpenAI API response: %w", err)
|
||||
}
|
||||
if resp.StatusCode == 429 {
|
||||
return nil, OpenAiUsage{}, fmt.Errorf("received 429 error code from OpenAI (is your API key valid?)")
|
||||
}
|
||||
var apiResp openAiResponse
|
||||
err = json.Unmarshal(bodyText, &apiResp)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user