-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getJSON fetch failure should not abort build #5643
Comments
|
Not sure what finding how finding who/what broke it will help fixing it. Why not just fix it? |
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 Before:
After:
|
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. |
I'd like to revive this issue as failures in The use case I have is that we're checking a database through its REST API for the existence of an entry to pull some metadata, and falling back to local data if not present. However, the only way we can check for the existence is to make a query, and if it's not there, the Specific error is this: Supposedly #5648 was meant to fix this, but from what I'm reading never did it properly? I don't know Go so I'm not sure exactly how to fix it, but I think I can trace its stack:
I have a couple ideas on what behavior I would like to see to make this more user and use-case friendly.
|
The getJSON function crashes the build if it cant find the page Known bug, they fixed it in pre 0.50, broke it in 0.50, and keep pushing its re-fix back gohugoio/hugo#5766 BUT! You can trap errors in custom shortcodes BUT! You can't USE custom shortcodes outside of stuff in the /content folder BUT! You can still error trap using the with...else...end statement. Its just undocumented outside of custom shortcodes BUT! (and this is the kicker) It still crashes the build... I brought this back up in gohugoio/hugo#5643
If I may just add my use case, to explain why this is important to me. This is from a forums thread a while ago:
@Lnaden thanks for reviving this and for your thoughts on the subject. |
Hi @Lnaden, Thank you for your report. However, since this issue was already fixed on v0.54, So, instead of "reviving" an old fixed issue, I think it would be better to open up a new issue that mentions this old issue. Thanks! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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.
The text was updated successfully, but these errors were encountered: