Sha256: 15aec2cb53d8938cdeb9dd7611643535c8cf513daa20165d170cc3e307a2015d

Contents?: true

Size: 912 Bytes

Versions: 25

Compression:

Stored size: 912 Bytes

Contents

##
# Raised when Mechanize encounters an error while reading the response body
# from the server.  Contains the response headers and the response body up to
# the error along with the initial error.

class Mechanize::ResponseReadError < Mechanize::Error

  attr_reader :body_io
  attr_reader :error
  attr_reader :mechanize
  attr_reader :response
  attr_reader :uri

  ##
  # Creates a new ResponseReadError with the +error+ raised, the +response+
  # and the +body_io+ for content read so far.

  def initialize error, response, body_io, uri, mechanize
    @body_io   = body_io
    @error     = error
    @mechanize = mechanize
    @response  = response
    @uri       = uri
  end

  ##
  # Converts this error into a Page, File, etc. based on the content-type

  def force_parse
    @mechanize.parse @uri, @response, @body_io
  end

  def message # :nodoc:
    "#{@error.message} (#{self.class})"
  end

end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
mechanize-2.7.7 lib/mechanize/response_read_error.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_read_error.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_read_error.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_read_error.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/response_read_error.rb
mechanize-2.7.6 lib/mechanize/response_read_error.rb
mechanize-2.7.5 lib/mechanize/response_read_error.rb
mechanize-2.7.4 lib/mechanize/response_read_error.rb
mechanize-2.7.3 lib/mechanize/response_read_error.rb
mechanize-2.7.2 lib/mechanize/response_read_error.rb
mechanize-2.7.1 lib/mechanize/response_read_error.rb
mechanize-2.7.0 lib/mechanize/response_read_error.rb
mechanize-2.6.0 lib/mechanize/response_read_error.rb
mechanize-2.5.1 lib/mechanize/response_read_error.rb
mechanize-2.5 lib/mechanize/response_read_error.rb
mechanize-2.4 lib/mechanize/response_read_error.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/response_read_error.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/response_read_error.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/response_read_error.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/response_read_error.rb