From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtVb9-0004ml-Vo for qemu-devel@nongnu.org; Sun, 21 Mar 2010 20:34:28 -0400 Received: from [199.232.76.173] (port=36241 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtVb8-0004md-On for qemu-devel@nongnu.org; Sun, 21 Mar 2010 20:34:26 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NtVb7-0001pD-3A for qemu-devel@nongnu.org; Sun, 21 Mar 2010 20:34:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64723) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NtVb6-0001p9-ND for qemu-devel@nongnu.org; Sun, 21 Mar 2010 20:34:24 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2M0YNQs011832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Mar 2010 20:34:24 -0400 Date: Sun, 21 Mar 2010 21:34:17 -0300 From: Luiz Capitulino Message-ID: <20100321213417.5a1f7f0b@redhat.com> In-Reply-To: References: <1268929996-28763-1-git-send-email-armbru@redhat.com> <1268929996-28763-5-git-send-email-armbru@redhat.com> <20100319164929.74810d16@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 04/11] error: New QERR_INVALID_PARAMETER_VALUE List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On Fri, 19 Mar 2010 22:05:53 +0100 Markus Armbruster wrote: > Luiz Capitulino writes: > > > On Thu, 18 Mar 2010 17:33:11 +0100 > > Markus Armbruster wrote: > > > >> > >> Signed-off-by: Markus Armbruster > >> --- > >> qerror.c | 4 ++++ > >> qerror.h | 3 +++ > >> 2 files changed, 7 insertions(+), 0 deletions(-) > >> > >> diff --git a/qerror.c b/qerror.c > >> index 9fb817e..97e8d4a 100644 > >> --- a/qerror.c > >> +++ b/qerror.c > >> @@ -121,6 +121,10 @@ static const QErrorStringTable qerror_table[] = { > >> .desc = "Invalid parameter type, expected: %(expected)", > >> }, > >> { > >> + .error_fmt = QERR_INVALID_PARAMETER_VALUE, > >> + .desc = "Parameter '%(name)' expects %(expected)", > >> + }, > > > > Would we need this error if we improve QERR_INVALID_PARAMETER to > > accept an optional 'expects' parameter? > > QERR_INVALID_PARAMETER_VALUE means "this value can't be accepted for > this parameter". > > QERR_INVALID_PARAMETER means "this parameter can't be accepted, > regardless of value". Pedantically speaking, that's a different error. > Pragmatically speaking, I doubt clients care much (but I'm the one who > doubts clients care much for differentiating errors in general, so I'm > biased). Practically speaking, we can use a single error class > 'InvalidParameter' if we don't care for the difference, but I figure we > still need separate QERR_ definitions, because we want different > human-readable error messages. > > Want me to do anything here now? Well, I agree with the human-readable argument. I'm a bit in doubt if adding new errors is the solution for that, but it's probably good enough for the immediate term. > > >> + { > >> .error_fmt = QERR_INVALID_PASSWORD, > >> .desc = "Password incorrect", > >> }, > >> diff --git a/qerror.h b/qerror.h > >> index 870cdc3..5625d54 100644 > >> --- a/qerror.h > >> +++ b/qerror.h > >> @@ -106,6 +106,9 @@ QError *qobject_to_qerror(const QObject *obj); > >> #define QERR_INVALID_PARAMETER_TYPE \ > >> "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }" > >> > >> +#define QERR_INVALID_PARAMETER_VALUE \ > >> + "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }" > >> + > >> #define QERR_INVALID_PASSWORD \ > >> "{ 'class': 'InvalidPassword', 'data': {} }" > >>