Re: [RFC obexd v0 1/2] gdbus: Add helper function for error-handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mikel,

On Thu, May 03, 2012, Mikel Astiz wrote:
> +DBusMessage *g_dbus_steal_from_gerror(DBusMessage *message, const char *name,
> +								GError **err)
> +{
> +	DBusMessage *reply;
> +
> +	reply = g_dbus_create_error(message, name, "%s", (*err)->message);
> +	g_clear_error(err);
> +
> +	return reply;
> +}

Did you consider following the semantics of dbus_set_error_from_message?

The calling code could then look something like:

	if (g_dbus_steal_from_gerror(&gerr, "foo.bar.baz", &reply))
		return reply;

	do other stuff since there was no error...

One thing that bothers me a bit is that you're forcing the use of a
single generic D-Bus error code for what may be a multitude of various
GError codes/domains (the only inherited part being the error message).
It'd be nice if we could somehow provide a mapping table from GError
codes/domains to D-Bus errors and only in the no-match case fall back to
a generic "org.bluez.Error.Failed".

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux