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

Returns a new instance of UnauthorizedError.



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

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

Instance Attribute Details

#challengesObject (readonly)

Returns the value of attribute challenges.



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

def challenges
  @challenges
end

Instance Method Details

#to_sObject



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

def to_s
  out = super

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

  out
end