Closed lionel- closed 1 year ago
Last commit fixes last_warnings()
support.
@jennybc this might be useful to include in reprex as well to get warning backtraces?
So you're saying I should add rlang_backtrace_on_warning_report = "full"
to the options being set here (?):
And perhaps add rlang::global_entrace()
before the options()
call?
So you're saying I should add rlang_backtrace_on_warning_report = "full" to the options being set here (?):
Exactly.
And perhaps add rlang::global_entrace() before the options() call?
Yes this is necessary for the global option above to have any effect. Also this will enable backtraces for base errors, if I'm not mistaken they're currently only shown for rlang errors.
@hadley now rebased
Special-case calls to
global_entrace()
inside Rmd documents to register calling handlers with the newknitr::opts_chunk$set(calling.handlers = )
added in https://github.com/yihui/knitr/pull/2079.cc @jennybc, with this you only need the following to entrace base errors in https://github.com/tidyverse/reprex/issues/230:
Resignal warnings enriched by
rlang::entrace()
. As discussed on Slack, this may cause bad interactions in extremely specific cases (a warning is resignalled from a warning calling handler without a corresponding restart - we'll suppress the outside warning in that case).Currently, we only support displaying the backtraces via
rlang::last_warnings()
and so we haven't needed resignalling the enriched warnings. We now resignal them in order to support the newrlang_backtrace_on_warning_report
option (see below). Once (or if) we become in control of warning display in R, resignalling will also be useful to automatically display backtraces on warning via arlang_backtrace_on_warning
option.Add
rlang_backtrace_on_warning_report
global option with an accompanyingsew()
method. Closes #1551. In conjunction withglobal_entrace()
, this allows displaying backtraces for all warnings emitted in an Rmd document.