Skip to content

Commit

Permalink
rename error for 429 (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartes authored Aug 12, 2024
1 parent f6274cd commit bd9d4f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/castle/core/process_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ProcessResponse
403 => Castle::ForbiddenError,
404 => Castle::NotFoundError,
419 => Castle::UserUnauthorizedError,
429 => Castle::TooManyRequestsError
429 => Castle::RateLimitError
}.freeze

INVALID_REQUEST_TOKEN = 'invalid_request_token'
Expand Down
2 changes: 1 addition & 1 deletion lib/castle/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class UnauthorizedError < Castle::ApiError
end

# api error too many requests 429
class TooManyRequestsError < Castle::ApiError
class RateLimitError < Castle::ApiError
end

# all internal server errors
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/castle/core/process_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
it_behaves_like 'response_failed', '404', Castle::NotFoundError
it_behaves_like 'response_failed', '419', Castle::UserUnauthorizedError
it_behaves_like 'response_failed', '422', Castle::InvalidParametersError
it_behaves_like 'response_failed', '429', Castle::TooManyRequestsError
it_behaves_like 'response_failed', '429', Castle::RateLimitError
it_behaves_like 'response_failed', '499', Castle::ApiError
it_behaves_like 'response_failed', '500', Castle::InternalServerError
end
Expand Down

0 comments on commit bd9d4f9

Please sign in to comment.