diff --git a/internal/reddit/client.go b/internal/reddit/client.go index 2313c03..582c84c 100644 --- a/internal/reddit/client.go +++ b/internal/reddit/client.go @@ -57,6 +57,7 @@ var ( 401: ErrOauthRevoked, 403: ErrOauthRevoked, 404: ErrSubredditNotFound, + 429: ErrTooManyRequests, } ) @@ -426,6 +427,7 @@ func (rac *AuthenticatedClient) markRateLimited(rli *RateLimitingInfo) error { func (rac *AuthenticatedClient) RefreshTokens(ctx context.Context, opts ...RequestOption) (*RefreshTokenResponse, error) { errmap := map[int]error{ 400: ErrOauthRevoked, + 429: ErrTooManyRequests, } opts = append(rac.client.defaultOpts, opts...) diff --git a/internal/reddit/errors.go b/internal/reddit/errors.go index c1fb179..b3109fe 100644 --- a/internal/reddit/errors.go +++ b/internal/reddit/errors.go @@ -31,4 +31,6 @@ var ( ErrSubredditIsQuarantined = errors.New("subreddit is quarantined") // ErrSubredditNotFound . ErrSubredditNotFound = errors.New("subreddit not found") + // ErrTooManyRequests . + ErrTooManyRequests = errors.New("too many requests") )