HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/rubygems-integration/all/gems/mechanize-2.7.7/lib/mechanize/response_code_error.rb
# 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