# class DBus::Error

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

### Attributes

dbus_message[R]

for received errors, the raw D-Bus message

name[R]

error_name. `message` is inherited from `Exception`

### Public Class Methods

new(msg, name = "org.freedesktop.DBus.Error.Failed") click to toggle source

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

Calls superclass method

    # 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