Exception: Mechanize::ResponseCodeError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mechanize/response_code_error.rb

Overview

Synopsis

This error is thrown 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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ ResponseCodeError

Returns a new instance of ResponseCodeError.



11
12
13
14
# File 'lib/mechanize/response_code_error.rb', line 11

def initialize(page)
  @page          = page
  @response_code = page.code
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



9
10
11
# File 'lib/mechanize/response_code_error.rb', line 9

def page
  @page
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



8
9
10
# File 'lib/mechanize/response_code_error.rb', line 8

def response_code
  @response_code
end

Instance Method Details

#inspectObject



20
# File 'lib/mechanize/response_code_error.rb', line 20

def inspect; to_s; end

#to_sObject



16
17
18
# File 'lib/mechanize/response_code_error.rb', line 16

def to_s
  "#{response_code} => #{Net::HTTPResponse::CODE_TO_OBJ[response_code]}"
end