From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjXlt-0005bp-Sg for qemu-devel@nongnu.org; Fri, 14 Dec 2012 11:05:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjXls-0000wb-OB for qemu-devel@nongnu.org; Fri, 14 Dec 2012 11:05:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjXls-0000wW-G1 for qemu-devel@nongnu.org; Fri, 14 Dec 2012 11:05:56 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBEG5t86008724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Dec 2012 11:05:56 -0500 Date: Fri, 14 Dec 2012 14:00:45 -0200 From: Luiz Capitulino Message-ID: <20121214140045.06876019@doriath.home> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 01/17] error: introduce handle_error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: qemu-devel@nongnu.org On Thu, 13 Dec 2012 16:40:35 +0100 Pavel Hrdina wrote: > Signed-off-by: Pavel Hrdina > --- > error.c | 8 ++++++++ > error.h | 6 ++++++ > 2 files changed, 14 insertions(+) > > diff --git a/error.c b/error.c > index 128d88c..dd3ab66 100644 > --- a/error.c > +++ b/error.c > @@ -113,3 +113,11 @@ void error_propagate(Error **dst_err, Error *local_err) > error_free(local_err); > } > } > + > +void handle_error(Error **errp) > +{ > + if (error_is_set(errp)) { > + error_report("%s", error_get_pretty(*errp)); > + error_free(*errp); > + } This is not good for a few reasons. The most important ones are that we most probably shouldn't be using error_report() in new qapi code. The other reason is that this function doesn't actually handle the error. I've added a similar function in hmp.c but just to save some typing, but we shouldn't do this elsewhere. > +} > diff --git a/error.h b/error.h > index 4d52e73..6a6acb5 100644 > --- a/error.h > +++ b/error.h > @@ -77,4 +77,10 @@ void error_propagate(Error **dst_err, Error *local_err); > */ > void error_free(Error *err); > > +/** > + * Print an error object as pretty string to current monitor or on stderr, then > + * free the errot object. > + */ > +void handle_error(Error **errp); > + > #endif