Exception: VirtualBox::COM::COMException

Inherits:
Exception
  • Object
show all
Defined in:
lib/virtualbox/com/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ COMException

Returns a new instance of COMException.



10
11
12
13
14
15
16
17
18
# File 'lib/virtualbox/com/exceptions.rb', line 10

def initialize(data={})
    @data = case data
            when Hash    then data
            when String  then { :message => data }
            when Integer then { :code    => data }
            else raise "don't know how to interprete exception parameter"
            end
    super("error in API call: 0x#{data[:code].to_s(16)}")
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/virtualbox/com/exceptions.rb', line 8

def data
  @data
end