On 1/4/20 7:06 PM, Nick Rosbrook wrote:
> On Fri, Dec 27, 2019 at 11:33 AM George Dunlap <george.dun...@citrix.com> 
> wrote:
>>
>> If an error is encountered deep in a complicated data structure, it's
>> often difficult to tell where the error actually is.  Make the error
>> message from the generated toC() and fromC() structures more
>> informative by tagging which field being converted encountered the
>> error.  This will have the effect of giving a "stack trace" of the
>> failure inside a nested data structure.
>>
>> Signed-off-by: George Dunlap <george.dun...@citrix.com>
> 
> Looks good, just one nit-picky comment:
> 
>> diff --git a/tools/golang/xenlight/gengotypes.py 
>> b/tools/golang/xenlight/gengotypes.py
>> index e4ed4d50f5..48e3d86f70 100644
>> --- a/tools/golang/xenlight/gengotypes.py
>> +++ b/tools/golang/xenlight/gengotypes.py
>> @@ -314,7 +314,7 @@ def xenlight_golang_convert_from_C(ty = None, outer_name 
>> = None, cvarname = None
>>          # If the type is not castable, we need to call its fromC
>>          # function.
>>          s += 'if err := x.{}.fromC(&{}.{});'.format(goname,cvarname,cname)
>> -        s += 'err != nil {\n return err \n}\n'
>> +        s += 'err != nil {{\nreturn fmt.Errorf("Converting field {}: %v", 
>> err) \n}}\n'.format(goname)
> 
> It's preferred style to keep error messages lowercase, unless a proper
> noun or acronym is used (the field names would be considered proper
> nouns).

Ack.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to