tests/testthat/fixtures/error-backtrace-empty.R

options(
  crayon.enabled = FALSE,
  cli.unicode = FALSE
)

library(rlang)

opt <- Sys.getenv("rlang_backtrace_on_error")
if (nzchar(opt)) {
  options(rlang_backtrace_on_error = opt)
}

depth <- as.integer(Sys.getenv("trace_depth"))

if (depth == 1) {
  f <- function() abort("foo")
  f()
} else {
  abort("foo")
}

Try the rlang package in your browser

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

rlang documentation built on Nov. 4, 2023, 9:06 a.m.