Method: Strava::Web::RaiseResponseError#on_complete

Defined in:
lib/strava/web/raise_response_error.rb

#on_complete(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/strava/web/raise_response_error.rb', line 9

def on_complete(env)
  case env[:status]
  when 404
    raise Faraday::ResourceNotFound, response_values(env)
  when 407
    # mimic the behavior that we get with proxy requests with HTTPS
    raise Faraday::ConnectionFailed, %(407 "Proxy Authentication Required ")
  when 429
    raise Strava::Errors::RatelimitError.new(env, response_values(env))
  when CLIENT_ERROR_STATUSES
    raise Strava::Errors::Fault, response_values(env)
  end
end