|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 5/9] go/xenlight: More informative error messages
On Fri, Dec 27, 2019 at 11:33 AM George Dunlap <george.dunlap@xxxxxxxxxx> 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.dunlap@xxxxxxxxxx>
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).
-NR
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |