Announcement: ruby-dbus 0.5.0 is a Gem with Errors

Martin Vidner mvidner at suse.cz
Wed Nov 10 01:47:20 PST 2010


Hi,

I have made a new release of [ruby-dbus][1], a [Ruby language][2]
binding for the [D-Bus IPC system][3].

[1]: https://trac.luon.net/ruby-dbus/
[2]: http://www.ruby-lang.org/
[3]: http://www.freedesktop.org/wiki/Software/dbus

The main feature is a better binding of Ruby Exceptions to D-Bus Errors. See
below for an excerpt of the documentation.

Perhaps more importantly, the library is now primarily packaged
as a [RubyGem][4] (Issue[#6][6]).
Also I converted the tutorial from [Webgen][7] to [Markdown][8].

[4]: http://rubygems.org/gems/ruby-dbus
[6]: https://github.com/mvidner/ruby-dbus/issues#issue/6
[7]: http://webgen.rubyforge.org/
[8]: http://daringfireball.net/projects/markdown/

Bug fixes:

* Don't pass file descriptors to subprocesses,
  they would not let go of the service name.
* Fixed InterfaceElement::validate_name (Ticket[#38][38], by Herwin Weststrate).
* Fixed a typo in InvalidDestinationName description (Ticket[#40][40]).

[38]: https://trac.luon.net/ruby-dbus/ticket/38
[40]: https://trac.luon.net/ruby-dbus/ticket/40

RPMs can be found via [openSUSE Build Service Search][9].
[9]: http://s.opensu.se/bs/rubygem-ruby-dbus

### Errors

D-Bus calls can reply with an error instead of a return value. An error is
translated to a Ruby exception.

    begin
        network_manager.sleep
    rescue DBus::Error => e
        puts e unless e.name == "org.freedesktop.NetworkManager.AlreadyAsleepOrAwake"
    end

### Replying with an error

To reply to a dbus_method with a D-Bus error, raise a `DBus::Error`,
as constructed by the `error` convenience function:

    raise DBus.error("org.example.Error.SeatOccupied"), "Seat #{seat} is occupied"

If the error name is not specified, the generic
`org.freedesktop.DBus.Error.Failed` is used.

    raise DBus.error, "Seat #{seat} is occupied"
    raise DBus.error

(This e-mail is written in Markdown itself. It is also a blog entry at
http://mvidner.blogspot.com/2010/11/ruby-dbus-050-is-gem-with-errors.html )
-- 
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20101110/e0fc2c99/attachment-0001.pgp>


More information about the dbus mailing list