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

Continue to refine build_articles() error #2477

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions R/build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ build_articles <- function(pkg = ".",
cli::cli_rule("Building articles")

build_articles_index(pkg)
purrr::walk(
unwrap_purrr_error(purrr::walk(
pkg$vignettes$name,
build_article,
pkg = pkg,
lazy = lazy,
seed = seed,
quiet = quiet
)
))

preview_site(pkg, "articles", preview = preview)
}
Expand Down Expand Up @@ -297,7 +297,8 @@ build_article <- function(name,
output_options = options,
seed = seed,
new_process = new_process,
quiet = quiet
quiet = quiet,
call = quote(build_article())
)
}

Expand Down
6 changes: 3 additions & 3 deletions R/rmarkdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ render_rmarkdown <- function(pkg, input, output, ..., seed = NULL, copy_images =
path <- withCallingHandlers(
callr::r_safe(rmarkdown_render_with_seed, args = args, show = !quiet),
error = function(cnd) {
lines <- strsplit(cnd$stderr, "\r?\n")[[1]]
lines <- strsplit(gsub("^\r?\n", "", cnd$stderr), "\r?\n")[[1]]
cli::cli_abort(
c(
x = "Failed to render RMarkdown document.",
set_names(lines, " ")
"!" = "Failed to render {.path {input}}.",
set_names(lines, "x")
),
parent = cnd$parent %||% cnd,
trace = cnd$parent$trace,
Expand Down
11 changes: 5 additions & 6 deletions tests/testthat/_snaps/rmarkdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
Reading assets/pandoc-fail.Rmd
Condition
Error:
x Failed to render RMarkdown document.
[WARNING] Could not fetch resource path-to-image.png
Failing because there were warnings.
! Failed to render 'assets/pandoc-fail.Rmd'.
x [WARNING] Could not fetch resource path-to-image.png
x Failing because there were warnings.
Caused by error:
! pandoc document conversion failed with error 3

Expand All @@ -30,9 +30,8 @@
Output
<error/rlang_error>
Error:
x Failed to render RMarkdown document.
Quitting from lines 6-13 [unnamed-chunk-1] (r-fail.Rmd)
! Failed to render 'assets/r-fail.Rmd'.
x Quitting from lines 6-13 [unnamed-chunk-1] (r-fail.Rmd)
Caused by error:
! Error!
---
Expand Down
Loading