R/catchWarning.R

Defines functions catchWarning

catchWarning <- 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)
}
pbreheny/html documentation built on April 17, 2025, 11:36 p.m.