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
mercadopago-custom-checkout-0.1.2 .gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb
faraday-0.15.2 lib/faraday/response/raise_error.rb
faraday-0.15.1 lib/faraday/response/raise_error.rb
mercadopago-custom-checkout-0.1.1 .gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb
faraday-0.15.0 lib/faraday/response/raise_error.rb
tdiary-5.0.8 vendor/bundle/gems/faraday-0.13.1/lib/faraday/response/raise_error.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/faraday-0.14.0/lib/faraday/response/raise_error.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/faraday-0.13.1/lib/faraday/response/raise_error.rb
tdiary-5.0.8 vendor/bundle/gems/faraday-0.14.0/lib/faraday/response/raise_error.rb
faraday-0.14.0 lib/faraday/response/raise_error.rb
tdiary-5.0.7 vendor/bundle/gems/faraday-0.13.1/lib/faraday/response/raise_error.rb
tdiary-5.0.6 vendor/bundle/gems/faraday-0.13.1/lib/faraday/response/raise_error.rb
faraday-0.13.1 lib/faraday/response/raise_error.rb
faraday-0.13.0 lib/faraday/response/raise_error.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/faraday-0.12.2/lib/faraday/response/raise_error.rb
faraday-0.12.2 lib/faraday/response/raise_error.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/faraday-0.12.1/lib/faraday/response/raise_error.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/faraday-0.12.1/lib/faraday/response/raise_error.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/faraday-0.11.0/lib/faraday/response/raise_error.rb
tdiary-5.0.5 vendor/bundle/gems/faraday-0.12.1/lib/faraday/response/raise_error.rb