@@ -140,27 +140,35 @@ quarto_run <- function(
140140 )
141141 },
142142 error = function (e ) {
143- msg <- c(x = " Error running quarto cli." )
144- # if there is an error message from quarto CLI, add it to the message
145- if (e $ stderr != " " ) {
146- quarto_error_msg <- xfun :: split_lines(e $ stderr )
147- names(quarto_error_msg ) <- rep(" " , length(quarto_error_msg ))
148- msg <- c(
149- msg ,
150- " " = paste0(rep(" -" , nchar(msg )), collapse = " " ),
151- quarto_error_msg
143+ if (! inherits(e , " system_command_status_error" )) {
144+ cli :: cli_abort(
145+ c(" !" = " Error running quarto CLI from R." ),
146+ call = .call ,
147+ parent = e
152148 )
153- }
149+ } else {
150+ msg <- c(x = " Error returned by quarto CLI." )
151+ # if there is an error message from quarto CLI, add it to the message
152+ if (e $ stderr != " " ) {
153+ quarto_error_msg <- xfun :: split_lines(e $ stderr )
154+ names(quarto_error_msg ) <- rep(" " , length(quarto_error_msg ))
155+ msg <- c(
156+ msg ,
157+ " " = paste0(rep(" -" , nchar(msg )), collapse = " " ),
158+ quarto_error_msg
159+ )
160+ }
154161
155- # if `--quiet` has been set, quarto CLI won't report any error (e$stderr will be empty)
156- # So remind user to run without `--quiet` to see the full error message
157- if (cli_arg_quiet() %in% args )
158- msg <- c(
159- msg ,
160- " i" = " Rerun with `quiet = FALSE` to see the full error message."
161- )
162+ # if `--quiet` has been set, quarto CLI won't report any error (e$stderr will be empty)
163+ # So remind user to run without `--quiet` to see the full error message
164+ if (cli_arg_quiet() %in% args )
165+ msg <- c(
166+ msg ,
167+ " i" = " Rerun with `quiet = FALSE` to see the full error message."
168+ )
162169
163- cli :: cli_abort(msg , call = .call , parent = e )
170+ cli :: cli_abort(msg , call = .call , parent = e )
171+ }
164172 }
165173 )
166174 invisible (res )
0 commit comments