R/is_class.R

Defines functions is_try_error

Documented in is_try_error

#' Is the element of class "try-error"?
#'
#' @param .x the object to test
#'
#' @return A logical
#' @export
#'
#' @examples
#' x <- attempt(log("a"), silent = TRUE)
#' is_try_error(x)
#'
is_try_error <- function(.x){
  any(
    vapply(class(.x), function(x) x == "try-error", logical(1))
  )
}

Try the attempt package in your browser

Any scripts or data that you put into this service are public.

attempt documentation built on May 4, 2020, 1:05 a.m.