Skip to content

Commit f7306e6

Browse files
committed
correctly add quarto-cli error message when reporting error in quarto_run
1 parent 18db58d commit f7306e6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

R/quarto.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,24 @@ quarto_run <- function(
6969
},
7070
error = function(e) {
7171
msg <- c(x = "Error running quarto cli.")
72+
# if there is an error message from quarto CLI, add it to the message
73+
if (e$stderr != "") {
74+
quarto_error_msg <- xfun::split_lines(e$stderr)
75+
msg <- c(
76+
msg,
77+
" " = paste0(rep("-", nchar(msg)), collapse = ""),
78+
setNames(quarto_error_msg, rep(" ", length(quarto_error_msg)))
79+
)
80+
}
81+
82+
# if `--quiet` has been set, quarto CLI won't report any error (e$stderr will be empty)
83+
# So remind user to run without `--quiet` to see the full error message
7284
if (cli_arg_quiet() %in% args)
7385
msg <- c(
7486
msg,
7587
"i" = "Rerun with `quiet = FALSE` to see the full error message."
7688
)
89+
7790
cli::cli_abort(msg, call = .call, parent = e)
7891
}
7992
)

0 commit comments

Comments
 (0)