error handling for method call without return value
Thiago Macieira
thiago at kde.org
Wed Jun 18 14:26:08 PDT 2008
Fritz Code wrote:
>But how can such an error-handling be achieved when you invoke a message
>without a return value by using message_send ?
>There is no error variable which gets passed!?
If you use message_send, it means you're not interested in knowing if
there was an error or not. That's why you don't get a DBusError.
To be strict, you could want to know if the message was written
successfully on the socket. Or if the bus daemon accepted it and
forwarded to the other side. But you never know if there's anyone
listening, so there's no way of telling... that's why there's no
DBusError.
>And:
>Using message_send_with_reply_and_block, makes only sense if the called
>method has a return value, right?
>A method with void as return should be called with message_send?
No.
You're mistaking "doesn't return any reply" with "sends a reply back with
no return values".
The C semantic of "void return value" maps to a normal method call in
D-Bus that sends a reply back, but which is empty. The simple fact that
the reply came back indicates success in the calling sequence. Otherwise,
you'd receive an error.
The D-Bus concept of "NoReply" method call doesn't exist in structured
programming languages (at least, that I know of). It really means "I'm
sending this, but I really don't care if anyone receives it or not"
(though, in most circumstances where you'd use this, you know someone
will be listening).
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080618/ac4fe4ac/attachment.pgp
More information about the dbus
mailing list