class Faraday::Response::RaiseError
def on_complete(env)
def on_complete(env) return if Array(options[:allowed_statuses]).include?(env[:status]) case env[:status] when *ClientErrorStatusesWithCustomExceptions.keys raise ClientErrorStatusesWithCustomExceptions[env[:status]], response_values(env) when 407 # mimic the behavior that we get with proxy requests with HTTPS msg = %(407 "Proxy Authentication Required") raise Faraday::ProxyAuthError.new(msg, response_values(env)) when ClientErrorStatuses raise Faraday::ClientError, response_values(env) when ServerErrorStatuses raise Faraday::ServerError, response_values(env) when nil raise Faraday::NilStatusError, response_values(env) end end