From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Myn0s-0000zS-MI for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:38:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Myn0m-0000yQ-Jm for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:38:33 -0400 Received: from [199.232.76.173] (port=40442 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Myn0j-0000y2-Av for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:38:28 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:35089) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Myn0i-0007CC-Ke for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:38:24 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9GDZrdc017419 for ; Fri, 16 Oct 2009 07:35:53 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9GDbwGH174902 for ; Fri, 16 Oct 2009 07:38:01 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n9GDbw8Z030786 for ; Fri, 16 Oct 2009 07:37:58 -0600 Message-ID: <4AD87735.2030509@us.ibm.com> Date: Fri, 16 Oct 2009 08:37:57 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error References: <1255453026-18637-1-git-send-email-lcapitulino@redhat.com> <1255453026-18637-7-git-send-email-lcapitulino@redhat.com> <1255561330.29192.2.camel@slab.beaverton.ibm.com> <20091015103405.591e2f3b@doriath> <1255626960.29192.7.camel@slab.beaverton.ibm.com> <20091015145208.1d871f09@doriath> <1255630433.29192.16.camel@slab.beaverton.ibm.com> <20091015160839.7dbef5bf@doriath> <4AD8211B.9090004@redhat.com> In-Reply-To: <4AD8211B.9090004@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, hollisb@linux.vnet.ibm.com, Luiz Capitulino Gerd Hoffmann wrote: > Hi, > >> { "error": { "code": 404, >> "desc": "husb: host usb device 0.12 is already open" } } >> >> In case I'm right, there are two problems with it: >> >> 1. It's hard to retrieve the variable information > > Markus asked it already, I'm asking again: > > *Do we actually need the variable information?* > > The point is that the information usually is available from context > anyway, i.e. if you get the reply above from a command like 'usb_add > host:0.12' you know it is host device 0.12 *without* parsing reply > because you know you've asked for host device 0.12. I would recommend treating errors like exceptions. In fact, if I were writing a python client library, this is exactly how I would model it. In fact, it would make sense to switch code to some sort of class name. This would be the exception class. The data argument would be the exception object. desc would basically be __str__() method although more limited. Very often, exceptions have very little data associated with them. Sometimes it's useful to include a bit of info though. -- Regards, Anthony Liguori