[ovs-dev] [unixctl_py 5/6] python: Add ovs_error() helper function to Python.

Ethan Jackson ethan at nicira.com
Mon Mar 5 13:57:05 PST 2012


I'm sorry, I don't fully understand what you're suggesting.  Could you
please give an example of a piece of code that should change?

Based on my reading of the code, when there's an error we return a
non-zero errno.  The errno is always an integer type.  Sometimes in
addition to the errno we return some additional information, but that
isn't used for checking error conditions.

Ethan

On Sun, Mar 4, 2012 at 21:23, Reid Price <reid at nicira.com> wrote:
> One other note, are you deliberately allowing None (along with other python
> expressions that are False as booleans) to equate to a 0 return code?  You
> may just want to check for integer type at the beginning of the function,
> since
> things compare across type without error (for error-free sorting purposes,
> ostensibly).  E.g.:
>
> {1: 2} > 0 == True
> "string" > 0 == True
>
> Some things will throw TypeErrors for the >0, like sets and complex numbers.
>
>   -Reid
>
> On Thu, Mar 1, 2012 at 5:40 PM, Ethan Jackson <ethan at nicira.com> wrote:
>>
>> > In the final case in ovs_retval_to_string(), I think I'd use %s
>> > instead of %d: maybe some non-integer value got passed in and my
>> > instinct is that it's probably better to convert it to a string than
>> > to throw an exception.
>>
>> Sounds good, I've folded the change in.
>>
>> Ethan
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
>
>



More information about the dev mailing list