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.2.1.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/response/raise_error.rb