R/pak-errors.R

Defines functions pkg_error

pkg_error <- function(
  ...,
  .data = NULL,
  .class = NULL,
  .envir = parent.frame(),
  call. = TRUE
) {
  .hide_from_trace <- TRUE
  cnd <- new_error(
    call. = call.,
    cli::format_error(
      .envir = .envir,
      c(
        ...
      )
    )
  )

  if (length(.data)) {
    cnd[names(.data)] <- .data
  }
  if (length(.class)) {
    class(cnd) <- c(.class, class(cnd))
  }

  cnd
}

Try the pak package in your browser

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

pak documentation built on June 7, 2026, 9:06 a.m.