Extend error information to include which data element causes the error

On a large website, it can be really hard to figure out exactly which data item has an error.
Getting an error like this:

Error: Error building site: failed to render pages: render of "page" failed: execute of template failed:  
 template: job/single.html:14:7: executing "body" at <partial "code-components/job.html" .>: error calling partial: "C:\git\aboutus\src\Website\layouts\partials\code-components\job.html:48:3": execute of  
 template failed: template: partials/code-components/job.html:48:3: executing "partials/code-components/job.html" at <len $params.branch.country>: error calling len: len of untyped nil  

Does not give sufficient information to pinpoint which one of the +500 articles we have using this template.
Would it be possible to provide this information for error messages?

Not easy to do as a general thing, but you can add this as validation logic to your template, e.g.:

{{ if not .Params.branch.country }}
{{ errorf "country not set in %q" .Path }}
{{ end }}


Yes that would be possible - but in our case the page data originates from a CMS system - and all unforseen editorial errors are impossible to cater for.
So - I think my suggestion would benefit most users of HUGO - by giving the needed information right where it belongs - in the error message - my anticipation is that if I can add .Path to the error output HUGO should be able too - right?