Class: CoinMarketCap::Cloud::Response::RaiseError

Inherits:
Faraday::Response::RaiseError
  • Object
show all
Defined in:
lib/coinmarketcap/cloud/response.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/coinmarketcap/cloud/response.rb', line 5

def on_complete(env)
  case env[:status]
  when 404
    raise Faraday::ResourceNotFound, response_values(env)
  when 401, 403
    raise CoinMarketCap::Errors::PermissionDeniedError, response_values(env)
  when ClientErrorStatuses
    raise CoinMarketCap::Errors::ClientError, response_values(env)
  else
    super
  end
end