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

WIP: Display error tracebacks when vignettes fail #2390

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hadley
Copy link
Contributor

@hadley hadley commented Jan 22, 2025

Recording some work so that I can come back to it later.

R/output.R Outdated Show resolved Hide resolved
res[i] = xfun:::handle_error(
withCallingHandlers(
if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
if (progress && is.function(pb$interrupt)) pb$interrupt()
if (xfun::pkg_available('rlang', '1.0.0')) rlang::entrace(e)

if (xfun::pkg_available('rlang', '1.0.0')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For vignettes, this implies that your package needs to depend on rlang. I think that's ok, but should be documented somewhere.

# return a string to point out the current location in the doc
get_loc = function(label = '') {
paste0(current_lines(), label, sprintf(' (%s)', knit_concord$get('infile')))
paste0(knit_concord$get('infile'), ":", current_lines(), label)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses a more standard format for file + line numbers that VS Code/Positron will autolink. I think it's still worthwhile to use cli here, so I'll explore adding that in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And cli hyperlinks don't work in R CMD check anyway, because if it did, it would open in the file in the check directory, not the current project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants