Skip to content
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

Include knit_fail() function to signal document failure (but not rendering failure) #2224

Open
Tracked by #2230
rich-iannone opened this issue Feb 10, 2023 · 2 comments
Assignees
Labels
feature Feature requests

Comments

@rich-iannone
Copy link
Collaborator

rich-iannone commented Feb 10, 2023

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 the reason 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 #2230.

@cderv
Copy link
Collaborator

cderv commented Feb 10, 2023

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.

@rich-iannone
Copy link
Collaborator Author

Will talk to Hadley about two alternatives: (1) SimpleError, and (2) knit.exit().

@cderv cderv moved this from To discuss / To plan to Next / Ready for Dev in R Markdown Team Projects Mar 7, 2023
@rich-iannone rich-iannone moved this from Next / Ready for Dev to To discuss / To plan in R Markdown Team Projects May 2, 2023
@yihui yihui added feature Feature requests and removed knitr-Connect labels May 19, 2023
@cderv cderv moved this from To discuss / To plan to Backlog in R Markdown Team Projects May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature requests
Projects
None yet
Development

No branches or pull requests

3 participants