Learn R Programming

future (version 1.34.0)

backtrace: Back trace the expressions evaluated when an error was caught

Description

Back trace the expressions evaluated when an error was caught

Usage

backtrace(future, envir = parent.frame(), ...)

Value

A list with the future's call stack that led up to the error.

Arguments

future

A future with a caught error.

envir

the environment where to locate the future.

...

Not used.

Examples

Run this code
my_log <- function(x) log(x)
foo <- function(...) my_log(...)

f <- future({ foo("a") })
res <- tryCatch({
  v <- value(f)
}, error = function(ex) {
  t <- backtrace(f)
  print(t)
})
# \dontshow{
## R CMD check: make sure any open connections are closed afterward
if (!inherits(plan("next"), "sequential")) plan(sequential)
# }

Run the code above in your browser using DataLab