qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors
Date: Thu, 31 May 2012 17:49:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Il 31/05/2012 17:44, Luiz Capitulino ha scritto:
>> One is "do not shoehorn errors into errno values".  So for QOM invalid 
>> values we
>> have PropertyValueBad, not a generic InvalidArgument value.  We convert 
>> everything
>> to Error rather than returning negative errno values and then returning 
>> generic
>> error codes, because those would be ugly and non-descriptive.  I agree with 
>> that.
>>
>> The other is "when errors come straight from the OS, _do_ use errno values".
>> This is for OpenFileFailed, for the new socket errors and so on.  This is 
>> what
>> I am proposing.
>>
>> These two rules together match what most other programs do.
>>
>>     $ echo | sed p > /dev/full
>>     sed: couldn't flush stdout: No space left on device
>>          ^^^^^^^^^^^^^^                                 error type
>>                         ^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^ arguments
>>
>> That would become, in JSON:
>>
>>     { 'error': 'FlushFailed',
>>       'file': 'stdout',
>>       'os_error': 'enospc' }
> 
> Actually, I did propose something similar in the past but Anthony objected.

Looks like in the meanwhile we moved closer to this mechanism
(OpenFileFailed, Sock*, etc.), except we have no clear way to identify
_what_ error actually happened rather than _where_.

> We could have optional arguments to NoSpaceLeftOnDevice. Could bloat the 
> error,
> or not (as most error scenarios can be common to each other).

Not as soon as you start reusing the same errors for QOM or similar
scenarios (like PermissionDenied).

Paolo



reply via email to

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