From 0cfa6e3949d99135f02a89cf32606dc2429b2d88 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 31 Oct 2024 16:00:00 +0000 Subject: [PATCH] Fixed stderr messaging. only shows if non empty for footnote addition --- R/add_footnotes.R | 4 ++-- R/build_report.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/add_footnotes.R b/R/add_footnotes.R index 5555093..2f9bad5 100644 --- a/R/add_footnotes.R +++ b/R/add_footnotes.R @@ -133,7 +133,7 @@ add_footnotes <- function(docx_in, result <- processx::run( command = uv_path, args = fig_args, env = c("current", VIRTUAL_ENV = venv_path), error_on_status = TRUE ) - if (length(result$stderr) != 0) { + if (nzchar(result$stderr)) { log4r::warn(.le$logger, paste0("Figure footnotes script stderr: ", result$stderr)) } }, error = function(e) { @@ -152,7 +152,7 @@ add_footnotes <- function(docx_in, result <- processx::run( command = uv_path, args = tab_args, env = c("current", VIRTUAL_ENV = venv_path), error_on_status = TRUE ) - if (length(result$stderr) != 0) { + if (nzchar(result$stderr)) { log4r::warn(.le$logger, paste0("Table footnotes script stderr: ", result$stderr)) } }, error = function(e) { diff --git a/R/build_report.R b/R/build_report.R index c1d91e5..b79096b 100644 --- a/R/build_report.R +++ b/R/build_report.R @@ -103,7 +103,7 @@ build_report <- function(docx_in, ) }) }, error = function(e) { - log4r::error(.le$logger, paste("Figure footnotes script failed:", e$message)) + log4r::error(.le$logger, paste("Footnotes scripts failed:", e$message)) stop("build_report stopped: Failed to add footnotes due to an error in add_footnotes.", call. = FALSE) }) }