diff --git a/discogs.go b/discogs.go index 73fac98..86c6f02 100644 --- a/discogs.go +++ b/discogs.go @@ -105,6 +105,8 @@ func request(path string, params url.Values, resp interface{}) error { switch response.StatusCode { case http.StatusUnauthorized: return ErrUnauthorized + case http.StatusTooManyRequests: + return ErrTooManyRequests default: return fmt.Errorf("unknown error: %s", response.Status) } diff --git a/errors.go b/errors.go index ed7d9a4..bbbcc5a 100644 --- a/errors.go +++ b/errors.go @@ -16,10 +16,11 @@ func (e *Error) Error() string { // APIErrors var ( - ErrUnauthorized = &Error{"authentication required"} ErrCurrencyNotSupported = &Error{"currency does not supported"} - ErrUserAgentInvalid = &Error{"invalid user-agent"} ErrInvalidReleaseID = &Error{"invalid release id"} ErrInvalidSortKey = &Error{"invalid sort key"} ErrInvalidUsername = &Error{"invalid username"} + ErrTooManyRequests = &Error{"too many requests"} + ErrUnauthorized = &Error{"authentication required"} + ErrUserAgentInvalid = &Error{"invalid user-agent"} )