From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9f5M-00014G-8J for qemu-devel@nongnu.org; Thu, 17 Dec 2015 15:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9f5J-0005OK-1n for qemu-devel@nongnu.org; Thu, 17 Dec 2015 15:23:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9f5I-0005OE-Sh for qemu-devel@nongnu.org; Thu, 17 Dec 2015 15:23:32 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 83B6CC0B9303 for ; Thu, 17 Dec 2015 20:23:32 +0000 (UTC) References: <1450371004-26866-1-git-send-email-armbru@redhat.com> <1450371004-26866-10-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <567319C3.8090105@redhat.com> Date: Thu, 17 Dec 2015 13:23:31 -0700 MIME-Version: 1.0 In-Reply-To: <1450371004-26866-10-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="S0WBCgNHe5wfRhfF4FpoTLhovSOqdxAAI" Subject: Re: [Qemu-devel] [PATCH v2 09/23] error: New error_prepend(), error_reportf_err() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --S0WBCgNHe5wfRhfF4FpoTLhovSOqdxAAI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/17/2015 09:49 AM, Markus Armbruster wrote: > Instead of simply propagating an error verbatim, we sometimes want to > add to its message, like this: >=20 > frobnicate(arg, &err); > error_setg(errp, "Can't frobnicate %s: %s", > arg, error_get_pretty(err)); Did you intend to have literal TABs in the commit message? > error_free(err); >=20 > This is suboptimal, because it loses err's hint (if any). Moreover, > when errp is &error_abort or is subsequently propagated to > &error_abort, the abort message points to the place where we last > added to the error, not to the place where it originated. >=20 > To avoid these issues, provide means to add to an error's message in > place: >=20 > frobnicate(arg, errp); > error_prepend(errp, "Can't frobnicate %s: ", arg); >=20 > Likewise, reporting an error like >=20 > frobnicate(arg, &err); > error_report("Can't frobnicate %s: %s", arg, error_get_pretty(err))= ; >=20 > can lose err's hint. To avoid: >=20 > error_reportf_err(err, "Can't frobnicate %s: ", arg); >=20 > The next commits will put these functions to use. >=20 > Signed-off-by: Markus Armbruster > --- > include/qapi/error.h | 31 +++++++++++++++++++++++++++++-- > util/error.c | 33 +++++++++++++++++++++++++++++++++ > 2 files changed, 62 insertions(+), 2 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --S0WBCgNHe5wfRhfF4FpoTLhovSOqdxAAI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWcxnDAAoJEKeha0olJ0NqnFAIAIeKH3em7mX32gOUJV7XFCNx SXbWIn6a6/dK0vGd7IEq6caNnRG6aZStMpHMUdEs7CbqOKALBT+lPeYEFMLeSuq9 sXgDkRoFNSYxG0snfdAjWbgsjWYc5e7g1LiVGIZRgcubFckpo7FPflvEq/yg7Jc6 mE8gFAI2VOZMKPwcp2jAkueRSTW/EDBWfc1j4CpbbUhqbfJOekzYyNO1H2d0LMTe UxwHVQfDakKvqn2HhvziIzYEM6/MB39I7YMJdB70Dp14fZfngULLjfp1Mpcf0XOe aoBOmPKX4oqvs04crliFTaYzgE7ZaX62NVlcGCE8drsKqzloAmgtF/H28zMZ+fE= =kQ+I -----END PGP SIGNATURE----- --S0WBCgNHe5wfRhfF4FpoTLhovSOqdxAAI--