Exception: WifiWand::NetworkDisconnectionError

Inherits:
Error
  • Object
show all
Defined in:
lib/wifi_wand/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Error

#append_help_hint?, #display_message, #exception, #message_for_display

Constructor Details

#initialize(network_name:, reason: nil) ⇒ NetworkDisconnectionError

Returns a new instance of NetworkDisconnectionError.



57
58
59
60
61
62
63
64
# File 'lib/wifi_wand/errors.rb', line 57

def initialize(network_name:, reason: nil)
  @network_name = network_name
  @reason = reason
  msg = network_name ? "Failed to disconnect from network '#{network_name}'" :
    'Failed to disconnect from current network'
  msg += ": #{reason}" if reason
  super(msg)
end

Instance Attribute Details

#network_nameObject (readonly)

Returns the value of attribute network_name.



55
56
57
# File 'lib/wifi_wand/errors.rb', line 55

def network_name
  @network_name
end

#reasonObject (readonly)

Returns the value of attribute reason.



55
56
57
# File 'lib/wifi_wand/errors.rb', line 55

def reason
  @reason
end