Class: AirbnbApi::Util::ErrorHandling
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- AirbnbApi::Util::ErrorHandling
- Defined in:
- lib/airbnb_api/util/error_handling.rb
Constant Summary collapse
- ERROR_MAP =
{ 400 => AirbnbApi::Errors::BadRequest, 401 => true, 402 => true, 403 => true, 404 => true, 405 => AirbnbApi::Errors::RateLimit, 406 => true, 422 => true, 429 => AirbnbApi::Errors::RateLimit, 503 => AirbnbApi::Errors::RateLimit }.freeze
Instance Method Summary collapse
Instance Method Details
#on_complete(response) ⇒ Object
17 18 19 20 |
# File 'lib/airbnb_api/util/error_handling.rb', line 17 def on_complete(response) key = response[:status].to_i raise ERROR_MAP[key], response if ERROR_MAP.key? key end |