hugo: getJSON etc. should log ERROR but return nil in failure situations
If getJSON
fails to access a URL, it fails the Hugo build, and nothing gets built at all.
It would be better if it just returned nil. The user can then throw an errorf
if needed on detecting the returned value as nil.
While this recently came up again in the forum, I’ve personally witnessed this issue too.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (12 by maintainers)
Commits related to this issue
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to bep/hugo by bep 6 years ago
- tpl/data: Revise error handling in getJSON and getCSV The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076 — committed to gohugoio/hugo by bep 6 years ago
nil
is good, i can than output some default string or whatever fits.