sending self defined errors over dbus

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Aug 3 06:08:47 PDT 2007


On Fri, 03 Aug 2007 at 14:14:18 +0200, Steve Kreyer wrote:
> dbus_g_error_domain_register (AUXIN_ERROR, NULL, AUXIN_TYPE_ERROR);

You need to tell dbus-glib what the error prefix is for your errors, for
instance:

/* during initialization */
dbus_g_error_domain_register (AUXIN_ERROR, "com.example.Auxin.Errors",
    AUXIN_TYPE_ERROR);
...
/* during runtime */
g_set_error (error, AUXIN_ERROR, AUXIN_ERROR_IT_BROKE, "Something's wrong");

That would give you errors of the form com.example.Auxin.Errors.ItBroke
(where "ItBroke" is the value_nick member of the GEnumValue structure
corresponding to AUXIN_ERROR_IT_BROKE).

	Simon


More information about the dbus mailing list