Re: [Dbus-cxx-users] Feature request with patch proposal: propagate exceptions through DBus
Status: Beta
Brought to you by:
rvinyard
From: Robert M. <rmi...@sy...> - 2013-10-08 13:32:09
|
You can attach patches here. I'll take a look at it, and see about putting it in. On a side note, I have been meaning to do exception handling for a while now, but I haven't gotten around to it. I know that dbus-java will catch all exceptions and then return an error message back onto the bus if an exception is caught or NULL is returned from a function. -Robert Middleton On Tue, Oct 8, 2013 at 5:24 AM, <emm...@or...> wrote: > 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. > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk > _______________________________________________ > Dbus-cxx-users mailing list > Dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbus-cxx-users > |