R/errorHandler.R

Defines functions errorsuppress errorlog ErrorHandler

ErrorHandler <- function(errors, ...) {
  stopifnot(errors %in% c("log", "suppress"))
  get(paste0("error", errors), mode = "function")(...)
}

errorlog <- function(...) {
  function(e) {
    futile.logger::flog.error(e$message)
    e
  }
}

errorsuppress <- function(...) {
  identity
}
INWT/mctools documentation built on Sept. 24, 2021, 9:19 p.m.