R/tryCatchWE.R

Defines functions tryCatchWE

#' @export

tryCatchWE <- function(expr)
{
  W <- NULL
  w.handler <- function(w){ # warning handler
    W <<- w
    invokeRestart("muffleWarning")
  }
  list(value = withCallingHandlers(tryCatch(expr, error = function(e) e),
                                   warning = w.handler),
       warning = W)
}
jaspwn/simbaR documentation built on Jan. 30, 2021, 4:09 a.m.