Errors and the introspection format

Matthew Johnson dbus at
Fri Feb 17 02:32:49 PST 2006

As far as I can see the introspection format has no way to define error
names, or declare that a function might return them. Have people
discussed this before and is this deliberate?

I think it would be very useful to know what errors you might expect to
have returned from a method call and people can surely define their own
errors for this purpose.

Error returns from method calls can easily be implemented with an
annotation (something like org.freedesktop.DBus.Throws or .Error), but
if we wanted to define new errors another element would be good to
define arguments (if an error can have anything other than a string
message?) or at least annotations.

This came up while I was writing the error support in the Java bindings,
if you call a method that returns an error it throws an exception of the
type given as the error name. To do this I need to create a class of
that type, which I can't do automatically if it isn't in the
introspection data. (you can also throw on if you want to return an
error from a method implemented on the server).



Matthew Johnson

More information about the dbus mailing list