Open rich-iannone opened 1 year ago
For reference, we have already a knit_exit()
function that allows to stop rendering in the middle of the document.
https://bookdown.org/yihui/rmarkdown-cookbook/knit-exit.html
There is no reason associated though - Don't know if tweaking this existing function would be enough for the use case shared.
Will talk to Hadley about two alternatives: (1) SimpleError, and (2) knit.exit()
.
For deployment purposes (e.g., Connect), it would be good to have a function like
knit_fail(reason)
to allow for a document-level failures. One scenario might be an .Rmd file deployed as data validation checkpoint where if a particular validation failed,knit_fail()
could be invoked to cause failure at the very end. Then Connect could make use of thereason
text and react accordingly (e.g., cancel deploy).One might use
stop()
for this type of thing but it would be better not to use that since (1) the document wouldn't be rendered and, (2) it would be useful for the user to inspect the rendered document and learn was caused the failure.Part of https://github.com/yihui/knitr/issues/2230.