follow-up from #4033
In scripts/build_pkgdown.R, build_quietly() collects warnings via tryCatch(..., warning = function(w) {...}). A tryCatch warning handler is an exiting handler, per ?conditions, control unwinds to the tryCatch frame before the handler runs, so (a) muffleWarning restart from the signalling context is no longer available, and (b) handler returning abandons the build_and_copy() call rather than resuming it.
This is consistent with the existing # TODO this branch doesn't ever seem to run comment, pkgdown appears to muffle its own warnings before they propagate here, and with the no 'restart' 'muffleWarning' found error that #4033 worked around with tryInvokeRestart. #4033 correctly stops the crash and is the variant ?conditions recommends; this issue is only about the structure.
If we want build_quietly() to actually collect warnings and keep building, use withCallingHandlers for the warning branch (handler runs in the signalling context, where muffleWarning is still available), keeping tryCatch for error.
Acceptance criteria:
- warning emitted during a pkgdown build is captured in the returned
warnings list without aborting that package's build
- the warning is muffled (not double printed)
- stale
# TODO ... doesn't ever seem to run comment is reconciled once the branch works
low priority, since #4033 already resolves the CI failure. This just makes the warning collection work as intended
follow-up from #4033
In
scripts/build_pkgdown.R,build_quietly()collects warnings viatryCatch(..., warning = function(w) {...}). AtryCatchwarning handler is an exiting handler, per?conditions, control unwinds to thetryCatchframe before the handler runs, so (a)muffleWarningrestart from the signalling context is no longer available, and (b) handler returning abandons thebuild_and_copy()call rather than resuming it.This is consistent with the existing
# TODO this branch doesn't ever seem to runcomment, pkgdown appears to muffle its own warnings before they propagate here, and with the no 'restart' 'muffleWarning' found error that #4033 worked around withtryInvokeRestart. #4033 correctly stops the crash and is the variant?conditionsrecommends; this issue is only about the structure.If we want build_quietly() to actually collect warnings and keep building, use
withCallingHandlersfor thewarningbranch (handler runs in the signalling context, wheremuffleWarningis still available), keepingtryCatchforerror.Acceptance criteria:
warningslist without aborting that package's build# TODO ... doesn't ever seem to runcomment is reconciled once the branch workslow priority, since #4033 already resolves the CI failure. This just makes the warning collection work as intended