Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAmqq-0004mz-8O for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:53:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAmql-0004k7-Fs for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:53:47 -0500 Received: from [199.232.76.173] (port=57609 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAmql-0004ju-Co for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:53:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59162) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAmqk-0007D7-MI for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:53:43 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [RFC 0/8]: QError v2 References: <1257365047-25895-1-git-send-email-lcapitulino@redhat.com> <4AFB2A9E.9050309@codemonkey.ws> <20091112114108.4cca3405@doriath> <4AFC1F33.4060405@linux.vnet.ibm.com> Date: Wed, 18 Nov 2009 16:53:37 +0100 In-Reply-To: <4AFC1F33.4060405@linux.vnet.ibm.com> (Anthony Liguori's message of "Thu, 12 Nov 2009 08:44:03 -0600") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Anthony Liguori , qemu-devel@nongnu.org, Luiz Capitulino , kraxel@redhat.com, pbonzini@redhat.com, hollisb@linux.vnet.ibm.com Anthony Liguori writes: > Luiz Capitulino wrote: >> >>> #define QERR_DEVICE_ALREADY_OPEN "{'class': 'DeviceAlreadyOpen', >>> data' : {'bus_num': %d, 'addr': %d}" >>> >>> qemu_error_new(QERR_DEVICE_ALREADY_OPEN, bus_num, addr); >>> >> >> What about DeviceAlreadyOpen errors with a different argument list? >> > > Why would you have this? That would seem like a problem to me. I > think the errors need to be very well structured (just like everything > else in QMP). > >>> That gives us a nice simple interface with full error checking on >>> the parameters. >>> >> >> I've said this is not so simple because people writing those macros >> would find out that the 'class' or 'data' _keys_ are missing or incorrect >> only at run-time, when the error is triggered. >> > > Sure but introducing new types of errors is not the common case. > Using existing errors is the common case. Careful. (Valid) reuse of existing errors may be more common, but proper creation of new errors is important. If you make that too hard compared to reuse, you risk abuse of existing errors for cases where they don't quite fit. [...]