Exception: Mechanize::UnauthorizedError

Inherits:
ResponseCodeError show all
Defined in:
lib/mechanize/unauthorized_error.rb

Instance Attribute Summary collapse

Attributes inherited from ResponseCodeError

#page, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(page, challenges, message) ⇒ UnauthorizedError


5
6
7
8
# File 'lib/mechanize/unauthorized_error.rb', line 5

def initialize page, challenges, message
  super page, message
  @challenges = challenges
end

Instance Attribute Details

#challengesObject (readonly)

Returns the value of attribute challenges


3
4
5
# File 'lib/mechanize/unauthorized_error.rb', line 3

def challenges
  @challenges
end

Instance Method Details

#to_sObject


10
11
12
13
14
15
16
17
18
19
# File 'lib/mechanize/unauthorized_error.rb', line 10

def to_s
  out = super

  if @challenges then
    realms = @challenges.map(&:realm_name).join ', '
    out << " -- available realms: #{realms}"
  end

  out
end