Skip to content

Commit e13f444

Browse files
committed
Add check for nil response in IsRateLimitError function
1 parent d92875a commit e13f444

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

errors/http_error_handling.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ func IsNonRetryableStatusCode(resp *http.Response) bool {
163163

164164
// IsRateLimitError checks if the provided response indicates a rate limit error.
165165
func IsRateLimitError(resp *http.Response) bool {
166+
if resp == nil {
167+
// If the response is nil, it cannot be a rate limit error.
168+
return false
169+
}
166170
return resp.StatusCode == http.StatusTooManyRequests
167171
}
168172

0 commit comments

Comments
 (0)