Skip to content

Commit 8cbd7bd

Browse files
authored
fix: Ensure resp is not nil before calling sentry.CheckResponse (#549)
1 parent 572f34e commit 8cbd7bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/sentryclient/rate_limiter.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ func NewRateLimiterRoundTripper(delegate http.RoundTripper) http.RoundTripper {
2020
retryClient.ErrorHandler = retryablehttp.PassthroughErrorHandler
2121
retryClient.Logger = nil // Disable DEBUG logs
2222
retryClient.Backoff = func(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
23-
if rateLimitErr, ok := sentry.CheckResponse(resp).(*sentry.RateLimitError); ok {
24-
return time.Until(rateLimitErr.Rate.Reset)
23+
if resp != nil {
24+
if rateLimitErr, ok := sentry.CheckResponse(resp).(*sentry.RateLimitError); ok {
25+
return time.Until(rateLimitErr.Rate.Reset)
26+
}
2527
}
2628
return retryablehttp.DefaultBackoff(min, max, attemptNum, resp)
2729
}

0 commit comments

Comments
 (0)