Module: Tavily::Errors
- Defined in:
- lib/tavily/errors.rb
Overview
Maps HTTP status codes to APIError subclasses.
Constant Summary collapse
- STATUS_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 400 => BadRequestError, 401 => AuthenticationError, 403 => ForbiddenError, 404 => NotFoundError, 422 => UnprocessableEntityError, 429 => RateLimitError, 432 => PlanLimitError, 433 => PayAsYouGoLimitError }.freeze
Class Method Summary collapse
-
.class_for(status) ⇒ Class
The most specific APIError subclass for
status.
Class Method Details
.class_for(status) ⇒ Class
Returns the most specific APIError subclass for status.
88 89 90 91 92 93 |
# File 'lib/tavily/errors.rb', line 88 def self.class_for(status) return STATUS_MAP[status] if STATUS_MAP.key?(status) return ServerError if status >= 500 APIError end |