throw_if_true <- function(param) { tryCatch({ if (param) stop("test exception") }, error = function(e) cat("except\n"), finally = cat("finally\n"))}throw_if_true(TRUE)# except# finallythrow_if_true(FALSE)# finally