R/util_is_try_error.R

Defines functions util_condition_from_try_error util_is_try_error

#' Check, if `x` is a try-error
#'
#' @param x
#'
#' @return [logical()] if it is a try-error
#' @noRd
util_is_try_error <- function(x) {
  inherits(x, "try-error")
}

#' Extract condition from try error
#'
#' @param x the try-error object
#'
#' @return [condition] of the try-error
#' @noRd
util_condition_from_try_error <- function(x) {
  if (!util_is_try_error(x)) {
    util_error("Internal error %s: Not a try-error. Please report, sorry.",
               dQuote(class(x)))
  } else {
    attr(x, "condition")
  }
}

Try the dataquieR package in your browser

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

dataquieR documentation built on Jan. 8, 2026, 5:08 p.m.