have errors for too many requests too

This commit is contained in:
Andre Medeiros 2023-03-16 09:33:51 -04:00
parent 9b0a884245
commit b0f7f6fccb
2 changed files with 4 additions and 0 deletions

View File

@ -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...)

View File

@ -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")
)