How to handle getJson errors?


I’m getting a bunch of JSON feeds using the getJSON function. However, not all those feeds exist.

Is there anyway to catch this error and ignore it?

Template changed /Users/..../partials/mytemplate.html
ERROR 2017/09/12 15:44:28 Failed to get json resource https:...



any answer to this ?

getJSON is supposed to return nil when an error occures, we’ve tried to test our var against nil in the following way but still hugo crash on with an error on getJSON

ERROR 2018/05/23 18:12:13 Error while rendering “page” in “ville/”: template:…/single.html:144:11: executing “main” at <partial "block-local…>: error calling partial: template: theme/partials/block-local-.html:64:21: executing “theme/partials/block-local.html” at <getJSON ($.Scratch.G…>: error calling getJSON: Get EOF

In our template
{{ dataJSON := (getJSON (.Scratch.Get “baseurlapi”) $element) }}
{{ if ne $dataJSON nil }}

{{ end }}
{{ end }}


looks like errors are catched in hugolib/site.go, we would need that error to be silent and not killing hugo, any advice to achieve that ?