Sha256: 08d705c747110ad6e7ac538f71ba3c3a5f72970d1ee32ac73f2858240fd96925

Contents?: true

Size: 656 Bytes

Versions: 80

Compression:

Stored size: 656 Bytes

Contents

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

Version data entries

80 entries across 73 versions & 10 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/faraday-0.17.0/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/faraday-0.17.0/lib/faraday/response/raise_error.rb
faraday-0.17.0 lib/faraday/response/raise_error.rb
tdiary-5.0.13 vendor/bundle/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
tdiary-5.0.12.1 vendor/bundle/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.3/lib/faraday/response/raise_error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.2/lib/faraday/response/raise_error.rb
faraday-0.15.4 lib/faraday/response/raise_error.rb
faraday-0.15.3 lib/faraday/response/raise_error.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/faraday-0.15.2/lib/faraday/response/raise_error.rb
tdiary-5.0.9 vendor/bundle/gems/faraday-0.15.1/lib/faraday/response/raise_error.rb