Pelagicore / gdbus-codegen-glibmm

Code generator for C++ D-Bus stubs and proxies using Giomm/Glibmm
GNU Lesser General Public License v2.1
23 stars 25 forks source link

Provide an error domain in generated error classes #42

Closed mardy closed 5 years ago

mardy commented 5 years ago

Due to the design of Glib::Error, the developer needs to have a way to retrieve the error domain associated with the generated error classes. We should offer a static method which returns the GQuark.

Meanwhile, if RTTI is enabled, one can use dynamic_cast, with some pain.

martin-ejdestig commented 5 years ago

I was a bit surprised that _finish() threw a Glib::Error and not the subclass of it that is in _common.h . So, I was thinking about sending a PR for this so a quark can be used and also document it in the README.md .

Do you have any suggestion for how the API should look? A static method in the generated glib::Error subclass called domain()? I have not used glibmm's Glib::Quark before and only have some experience with it in Glib. Don't know what best practices there are.