global_entrace() enriches base errors with rlang features:
They are assigned a backtrace. You can configure whether to display a backtrace on error with the rlang_backtrace_on_error global option.
They are recorded in
last_error(). Calling this function is
another way of inspecting the backtrace.
Set global entracing in your RProfile with:
global_entrace(enable = TRUE, class = c("error", "warning", "message"))
Whether to enable or disable entracing.
A character vector of one or several classes of conditions to be entraced.
On R 4.0 and newer,
global_entrace() installs a global handler
globalCallingHandlers(). On older R versions,
set as an
option(error = ) handler. The latter method has the
disadvantage that only one handler can be set at a time. This means
that you need to manually switch between
entrace() and other
recover(). Also this causes a conflict with IDE
handlers (e.g. in RStudio).