Exception: WifiWand::PublicIPLookupError
- Defined in:
- lib/wifi_wand/errors.rb
Overview
EXTERNAL SERVICE ERRORS ===
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#status_message ⇒ Object
readonly
Returns the value of attribute status_message.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(status_code: nil, status_message: nil, message: nil, url: nil, body: nil) ⇒ PublicIPLookupError
constructor
A new instance of PublicIPLookupError.
- #to_h ⇒ Object
Methods inherited from Error
#append_help_hint?, #display_message, #exception, #message_for_display
Constructor Details
#initialize(status_code: nil, status_message: nil, message: nil, url: nil, body: nil) ⇒ PublicIPLookupError
Returns a new instance of PublicIPLookupError.
420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/wifi_wand/errors.rb', line 420 def initialize(status_code: nil, status_message: nil, message: nil, url: nil, body: nil) @status_code = status_code @status_message = @url = url @body = body ||= if status_code "HTTP error fetching public IP info: #{status_code} #{}" else 'Public IP lookup failed' end super() end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
418 419 420 |
# File 'lib/wifi_wand/errors.rb', line 418 def body @body end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
418 419 420 |
# File 'lib/wifi_wand/errors.rb', line 418 def status_code @status_code end |
#status_message ⇒ Object (readonly)
Returns the value of attribute status_message.
418 419 420 |
# File 'lib/wifi_wand/errors.rb', line 418 def @status_message end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
418 419 420 |
# File 'lib/wifi_wand/errors.rb', line 418 def url @url end |
Instance Method Details
#to_h ⇒ Object
433 434 435 436 437 438 439 440 441 |
# File 'lib/wifi_wand/errors.rb', line 433 def to_h { message: , url: url, status_code: status_code, status_message: , body: body, } end |