fun <- function(x) x + 1
res <- try(fun(1), silent = TRUE)
check_error(res) # no error thrown
res <- try(fun('this'), silent = TRUE)
check_error(res) # throws error
# multiple error check
res2 <- try(fun('that'), silent = TRUE)
check_error(res, res2)Run the code above in your browser using DataLab