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

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

if (nzchar(Sys.getenv("rlang_interactive"))) {
  options(rlang_interactive = TRUE)
}

f <- function() tryCatch(g())
g <- function() h()
h <- function() rlang::abort("Error message")

tryCatch(
  f(),
  error = function(cnd) rlang::cnd_signal(cnd)
)
tidyverse/rlang documentation built on Oct. 31, 2024, 5:35 p.m.