From: Johan Hedberg <johan.hedberg@gmail.com>
To: Mikel Astiz <mikel.astiz.oss@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: Re: [RFC obexd v0 1/2] gdbus: Add helper function for error-handling
Date: Thu, 3 May 2012 14:23:04 +0300 [thread overview]
Message-ID: <20120503112304.GA9270@x220.ger.corp.intel.com> (raw)
In-Reply-To: <1336038275-19591-2-git-send-email-mikel.astiz.oss@gmail.com>
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
next prev parent reply other threads:[~2012-05-03 11:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 9:44 [RFC obexd v0 0/2] D-Bus error from GError Mikel Astiz
2012-05-03 9:44 ` [RFC obexd v0 1/2] gdbus: Add helper function for error-handling Mikel Astiz
2012-05-03 11:23 ` Johan Hedberg [this message]
2012-05-03 9:44 ` [RFC obexd v0 2/2] client: Use new D-Bus helper function Mikel Astiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120503112304.GA9270@x220.ger.corp.intel.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz.oss@gmail.com \
--cc=mikel.astiz@bmw-carit.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).