qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error
Date: Fri, 16 Oct 2009 08:37:57 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]