diff --git a/R/utils.R b/R/utils.R index b3b2911..cd24f4b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -2,12 +2,11 @@ with_warnings <- function(expr) { my_warnings <- NULL w_handler <- function(w) { - my_warnings <<- c(my_warnings, list(w)) + my_warnings <<- c(my_warnings, jsonlite::unbox(conditionMessage(w))) invokeRestart("muffleWarning") } val <- withCallingHandlers(expr, warning = w_handler) list(output = val, - warnings = lapply(my_warnings, - function(w) jsonlite::unbox(conditionMessage(w)))) + warnings = my_warnings) }