
On Thu, Oct 06, 2011 at 03:55:48PM -0400, Laine Stump wrote:
On 10/06/2011 01:36 PM, Guido Günther wrote:
Hi Eric, On Thu, Oct 06, 2011 at 10:50:46AM -0600, Eric Blake wrote:
These three errors should probably all be changed away from VIR_ERR_INTERNAL_ERROR into something more useful, but I'm not sure whether that would be VIR_ERR_CONF_SYNTAX, VIR_ERR_CONFIG_UNSUPPORTED, or something else.
I was uncertain about the error codes too, that's why I kept VIR_ERR_INTERNAL_ERROR as used by other functions in this file. I'd opt for VIR_ERR_CONF_SYNTAX.
We really need to agree on a policy on which code to use for which type of errors, write it down, then go through the code and correct everything that's wrong. INTERNAL_ERROR is used *a lot* in XML parsing where it obviously shouldn't be. Much of it is probably code written before the CONFIG_UNSUPPORTED, XML_ERROR, and CONF_SYNTAX codes were added, but I'd wager just as much is due to people writing new code who look to the existing code for guidelines (I know I've done this a lot, and continue to be confused about which code to use in a lot of cases - heck, this is the first I've noticed CONF_SYNTAX, and I'm not sure when it would be appropriate to use that vs. XML_ERROR).
We're not parsing XML here but xen configuration so CONF_SYNTAX fits better. When parsing XML XML_ERROR makes more sense but you're right that's mostly guessing at the moment. Cheers, -- Guido