entrace {rlang} | R Documentation |
Set the error
global option to quote(rlang::entrace())
to
transform base errors to rlang errors. These enriched errors
include a backtrace. The RProfile is a good place to set the
handler.
entrace()
also works as a calling handler, though it
is often more practical to use the higher-level function
with_abort()
.
entrace(cnd, ..., top = NULL, bottom = NULL)
cnd |
When |
... |
Unused. These dots are for future extensions. |
top |
The first frame environment to be included in the backtrace. This becomes the top of the backtrace tree and represents the oldest call in the backtrace. This is needed in particular when you call |
bottom |
The last frame environment to be included in the backtrace. This becomes the rightmost leaf of the backtrace tree and represents the youngest call in the backtrace. Set this when you would like to capture a backtrace without the capture context. Can also be an integer that will be passed to |
with_abort()
to promote conditions to rlang errors.
if (FALSE) { # Not run # Set the error handler in your RProfile like this: if (requireNamespace("rlang", quietly = TRUE)) { options(error = rlang::entrace) } }