Class: RelicLink::Coh3::Faraday::Response::RaiseHttpError
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- RelicLink::Coh3::Faraday::Response::RaiseHttpError
- Defined in:
- lib/relic_link/coh3/faraday/response/raise_http_error.rb
Overview
Middleware to catch CoH3 API errors and raise them as exceptions.
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
9 10 11 12 13 |
# File 'lib/relic_link/coh3/faraday/response/raise_http_error.rb', line 9 def on_complete(env) raise RelicLink::Errors::BadRequestError, env.response if env.status == 400 raise RelicLink::Errors::UnauthorizedError, env.response if env.status == 401 raise RelicLink::Errors::RateLimitError, env.response if env.status == 429 end |