Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
getJSON fetch failure should not abort build #5643
Hugo >= 0.50 (including master HEAD as of today) exits before finishing building a website when getJSON fails to get a resource.
This problem was earlier filed as Issue #5076 "getJSON etc. should log ERROR but return nil in failure situations" and was fixed in 0.49, but perhaps the "greatly improved error messages shown in browser" feature in 0.50 might have undone the fix in PR #5199.
changed the title
getJSON fetch failure aborts build in Hugo >= 0.50 (reprise of #5076)
Jan 27, 2019
I am actually trying to fix it; I am just documenting the progress along the way by pasting the result of the last "git bisect" command, though probably the output of that command was too verbose. I'll edit my last message to remove the details and just keep the commit hash to keep track of it.
Trying to find clues from the messages shown by
added a commit
Jan 28, 2019
referenced this issue
Jan 29, 2019
My first attempt at a fix is at PR #5648, though I am starting to think I tried to fix the problem at the wrong place, and at a cost too: The nice context information provided by _errors.Wrapf() (from pkg/errors) is lost. So, simply replacing with _errors.Wrapf() with ns.deps.Log.ERROR.Printf() reverting to the pre-0.50 behaviour of no error context isn't ideal.
I am thinking that there should be a way to distinguish between fatal and non-fatal errors, maybe with the non-fatal ones marked with a "[non-fatal]" suffix in the error string so it can be checked later. (I have just barely started looking at the error handling code, so what I just said may be utter nonsense, my apologies.) Unfortunately, I won't have time to look at this issue again in this week or the next, hence this note in case anyone else (or maybe the future "me") wants to pick it up.