Exception: SocketSwitcher::SocketSwitcherError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/socket_switcher/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#deviceObject

Returns the value of attribute device.



15
16
17
# File 'lib/socket_switcher/errors.rb', line 15

def device
  @device
end

Class Method Details

.for_device(device, message) ⇒ Object



3
4
5
6
7
# File 'lib/socket_switcher/errors.rb', line 3

def self.for_device(device, message)
  new(message).tap do |error|
    error.device = device
  end
end

.wrap(device, exception) ⇒ Object



9
10
11
12
13
# File 'lib/socket_switcher/errors.rb', line 9

def self.wrap(device, exception)
  for_device(device, "wrapped #{exception.class}: #{exception}").tap do |e|
    e.set_backtrace exception.backtrace
  end
end