From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7juq-0001i8-1C for qemu-devel@nongnu.org; Fri, 18 Nov 2016 09:13:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7jul-0002x9-2Q for qemu-devel@nongnu.org; Fri, 18 Nov 2016 09:13:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7juk-0002wv-Oz for qemu-devel@nongnu.org; Fri, 18 Nov 2016 09:13:14 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD05B32D3DE for ; Fri, 18 Nov 2016 14:13:13 +0000 (UTC) From: Markus Armbruster References: <20161117155504.21843-1-marcandre.lureau@redhat.com> <20161117155504.21843-13-marcandre.lureau@redhat.com> <87eg29jdna.fsf@dusky.pond.sub.org> <602698312.296363.1479465114767.JavaMail.zimbra@redhat.com> Date: Fri, 18 Nov 2016 15:13:11 +0100 In-Reply-To: <602698312.296363.1479465114767.JavaMail.zimbra@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Fri, 18 Nov 2016 05:31:54 -0500 (EST)") Message-ID: <8737ioho5k.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 12/17] qapi: rename QAPIExprError/QAPILineError List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org Marc-Andr=C3=A9 Lureau writes: > ----- Original Message ----- >> Make the summary line "qapi: Rename QAPIExprError to QAPILineError". >>=20 > > ok > >> Marc-Andr=C3=A9 Lureau writes: >>=20 >> > There is nothing specific about expressions in this exception, >> > the following patch will use it without expressions. >> > >> > Signed-off-by: Marc-Andr=C3=A9 Lureau >> > --- >> > scripts/qapi.py | 146 >> > ++++++++++++++++++++++++++++---------------------------- >> > 1 file changed, 73 insertions(+), 73 deletions(-) >> > >> > diff --git a/scripts/qapi.py b/scripts/qapi.py >> > index 21bc32f..4d1b0e4 100644 >> > --- a/scripts/qapi.py >> > +++ b/scripts/qapi.py >> > @@ -110,11 +110,11 @@ class QAPISchemaError(Exception): >> > "%s:%d:%d: %s" % (self.fname, self.line, self.col, self.m= sg) >> >=20=20 >> >=20=20 >> > -class QAPIExprError(Exception): >> > - def __init__(self, expr_info, msg): >> > +class QAPILineError(Exception): >> > + def __init__(self, info, msg): >> > Exception.__init__(self) >> > - assert expr_info >> > - self.info =3D expr_info >> > + assert info >> > + self.info =3D info >> > self.msg =3D msg >> >=20=20 >> > def __str__(self): >>=20 >> Since we're talking about misnamed / awkward error stuff: >>=20 >> * QAPISchemaError is really a parse error. __init__()'s schema argument >> isn't a QAPISchema, it's a QAPISchemaParser. >>=20 >> * Method __str__() is mostly duplicated. >>=20 >> How do you like the following untested sketch? > > I like it, though I would consider it separately from this series. Punting ideas we both like to later series is fair. But when we intend to rework the error classes later, renaming one of them now is perhaps not worth the churn. > Here I systematically renamed the existing class ("line" since it's > about location in file), your proposed change has more implications I > don't really want to get into here. Well, QAPISchemaError is just as much about "location in file" as QAPIExprError. They just specify the location differently: one by reference to the parser's current location, and the other by an "info" dictionary. [...]