If you wish to report an error condition in a method call you can throw an instance of DBusExecutionException12 . This will be sent back to the caller as an error message, and the error name is taken from the class name of the exception. For example, if you wanted to report an unknown method you would define an exception as in figure 6 and then throw it in your method as in figure 7.
...
public void throwme() throws org.freedesktop.DBus.Error.UnknownMethod { throw new org.freedesktop.DBus.Error.UnknownMethod("hi"); } ...
|
If you are calling a remote method and you want to handle such an error you can simply catch the exception as in figure 8.
...
try { remote.throwme(); } catch (org.freedesktop.DBus.Error.UnknownMethod UM) { ... } ...
|