Sha256: 24509c58a1848cf12a738dc580b7a40c89a5295fed8c3218f9851de2d9a3ce20

Contents?: true

Size: 766 Bytes

Versions: 16

Compression:

Stored size: 766 Bytes

Contents

# This error is raised when Mechanize encounters a response code it does not
# know how to handle.  Currently, this exception will be thrown if Mechanize
# encounters response codes other than 200, 301, or 302.  Any other response
# code is up to the user to handle.

class Mechanize::ResponseCodeError < Mechanize::Error
  attr_reader :response_code
  attr_reader :page

  def initialize(page, message = nil)
    super message

    @page          = page
    @response_code = page.code.to_s
  end

  def to_s
    response_class = Net::HTTPResponse::CODE_TO_OBJ[@response_code]
    out = "#{@response_code} => #{response_class} "
    out << "for #{@page.uri} " if @page.respond_to? :uri # may be HTTPResponse
    out << "-- #{super}"
  end

  alias inspect to_s
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
mechanize-2.7.7 lib/mechanize/response_code_error.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_code_error.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_code_error.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_code_error.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_code_error.rb
mechanize-2.7.6 lib/mechanize/response_code_error.rb
mechanize-2.7.5 lib/mechanize/response_code_error.rb
mechanize-2.7.4 lib/mechanize/response_code_error.rb
mechanize-2.7.3 lib/mechanize/response_code_error.rb
mechanize-2.7.2 lib/mechanize/response_code_error.rb
mechanize-2.7.1 lib/mechanize/response_code_error.rb
mechanize-2.7.0 lib/mechanize/response_code_error.rb
mechanize-2.6.0 lib/mechanize/response_code_error.rb
mechanize-2.5.1 lib/mechanize/response_code_error.rb
mechanize-2.5 lib/mechanize/response_code_error.rb
mechanize-2.4 lib/mechanize/response_code_error.rb