Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backtrace truncated #856

Closed
gaborcsardi opened this issue Oct 25, 2019 · 0 comments · Fixed by #1035
Closed

Backtrace truncated #856

gaborcsardi opened this issue Oct 25, 2019 · 0 comments · Fixed by #1035

Comments

@gaborcsardi
Copy link
Member

There is a limit for the length of the error message, the default is 1000 characters, and it can be set higher, but the max is 8192. Since the trace is printed as part of the error message, this means that the trace can be truncated, which is especially not great in non-interactive sessions. E.g.

cat(deparse(substitute({
  ff <- lapply(1:10, function(i) {
    assign(
      paste0("f", i), function() do.call(paste0("f", i-1), list()),
      envir = .GlobalEnv)
  })
  
  f0 <- function() rlang::abort("oops")
  
  f10()
})), file = tmp <- tempfile(), sep = "\n")

out <- processx::run("R", c("-q", "-f", tmp))
cat(out$stderr)
#> Error: oops
#> Backtrace:
#>      █
#>   1. └─f10()
#>   2.   ├─base::do.call(paste0("f", i - 1), list())
#>   3.   └─f9()
#>   4.     ├─base::do.call(paste0("f", i - 1), list())
#>   5.     └─f8()
#>   6.       ├─base::do.call(paste0("f", i - 1), list())
#>   7.       └─f7()
#>   8.         ├─base::do.call(paste0("f", i - 1), list())
#>   9.         └─f6()
#>  10.           ├─base::do.call(paste0("f", i - 1), list())
#>  11.           └─f5()
#>  12.             ├─base::do.call(paste0("f", i - 1), list())
#>  13.             └─f4()
#>  14.               ├─base::do.call(paste0("f", i - 1), list())
#>  15.               └─f3()
#>  16.                 ├─base::do.call(paste0("f", i - 1), list())
#>  17.                 └─f2()
#>  18.                   ├─base::do.call(paste0("f", i - 1), list())
#>  19.                   └─f1()
#>  20.                     ├─base::do.call(paste0("f", i - 1), list())
#>  21.                     └─global::f0()

Created on 2019-10-25 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants