Exception: DBus::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dbus/error.rb

Overview

Represents a D-Bus Error, both on the client and server side.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, name = "org.freedesktop.DBus.Error.Failed") ⇒ Error

If msg is a DBus::Message, its contents is used for initialization. Otherwise, msg is taken as a string and name is used.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dbus/error.rb', line 21

def initialize(msg, name = "org.freedesktop.DBus.Error.Failed")
  if msg.is_a? DBus::Message
    @dbus_message = msg
    @name = msg.error_name
    super(msg.params[0]) # or nil
    if msg.params[1].is_a? Array
      set_backtrace msg.params[1]
    end
  else
    @name = name
    super(msg)
  end
  # TODO validate error name
end

Instance Attribute Details

#dbus_messageObject (readonly)

for received errors, the raw D-Bus message



17
18
19
# File 'lib/dbus/error.rb', line 17

def dbus_message
  @dbus_message
end

#nameObject (readonly)

error_name. message is inherited from Exception



15
16
17
# File 'lib/dbus/error.rb', line 15

def name
  @name
end