/usr/lib/ruby/vendor_ruby/faraday/response/raise_error.rb is in ruby-faraday 0.9.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | module Faraday
class Response::RaiseError < Response::Middleware
ClientErrorStatuses = 400...600
def on_complete(env)
case env[:status]
when 404
raise Faraday::Error::ResourceNotFound, response_values(env)
when 407
# mimic the behavior that we get with proxy requests with HTTPS
raise Faraday::Error::ConnectionFailed, %{407 "Proxy Authentication Required "}
when ClientErrorStatuses
raise Faraday::Error::ClientError, response_values(env)
end
end
def response_values(env)
{:status => env.status, :headers => env.response_headers, :body => env.body}
end
end
end
|