Sha256: c8109ddb093bf51f48364ea8bcda7be74d7fe310776edc73fc672c86c4006c20

Contents?: true

Size: 440 Bytes

Versions: 11

Compression:

Stored size: 440 Bytes

Contents

module Faraday
  class Response::RaiseError < Response::Middleware
    def on_complete(env)
      case env[:status]
      when 404
        raise Faraday::Error::ResourceNotFound, response_values(env)
      when 400...600
        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

11 entries across 11 versions & 3 rubygems

Version Path
faraday-0.8.7 lib/faraday/response/raise_error.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/faraday-0.8.6/lib/faraday/response/raise_error.rb
faraday-0.8.6 lib/faraday/response/raise_error.rb
faraday-0.8.5 lib/faraday/response/raise_error.rb
faraday-0.8.4 lib/faraday/response/raise_error.rb
faraday-0.8.2 lib/faraday/response/raise_error.rb
avdi-faraday-0.8.1 lib/faraday/response/raise_error.rb
faraday-0.8.1 lib/faraday/response/raise_error.rb
faraday-0.8.0 lib/faraday/response/raise_error.rb
faraday-0.8.0.rc2 lib/faraday/response/raise_error.rb
faraday-0.7.6 lib/faraday/response/raise_error.rb