[Dbus-cxx-users] Feature request with patch proposal: propagate exceptions through DBus
Status: Beta
Brought to you by:
rvinyard
From: <emm...@or...> - 2013-10-08 09:42:22
|
Hello, DBus provides the possibility for a method call to throw an error. However DBus-cxx in its current shape doesn't mirror this feature; message call handlers don't catch exceptions so, if an error condition arises in a slot bound to a DBus method, the exception is bubbled all the way up to the dispatcher and stops it. A possibility is of course to use return codes in APIs exposed over DBus rather than throw exceptions but that doesn't feel like the way of modern C++. My proposal would be to call the slot bound to a DBus method in a try block and catch std::exception&. In the case an exception occured, a DBus error message can be sent as a reply to the caller. I made a patch for that purpose, which I can provide. It might be a little quick & dirty though, as I had to change the signature of one of the DBus::ErrorMessage constructors (the one that constructs a reply) to accept a Message::const_pointer as first argument. I don't know if the mailing list is the right place to send the patch. Thanks in advance for your support. Regards, -- Emmanuel Raulo-Kumagai _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. |