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

Don't show backtrace #449

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# reprex (development version)

* `reprex()` no longer includes the full traceback by default, as this is
only useful in relatively rare situations, and otherwise adds a bunch
of clutter (#448).

The unexported `prex_*()` functions protect the current session from option changes coming from reprex's own machinery, such as disabling color (#427).

# reprex 2.0.2
Expand Down
14 changes: 4 additions & 10 deletions R/reprex.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@
#'
#' @section Error backtraces:
#'
#' reprex sets the rlang option `rlang_backtrace_on_error_report = "full"`.
#' Combined with the knitr option `error = TRUE`, this means rlang errors are
#' displayed with a full backtrace. This basically eliminates the need to call
#' [rlang::last_error()] or [rlang::last_trace()] explicitly, although these
#' functions can be used in a reprex.
#'

#' Insert a line containing the special comment `#'` in between the
#' error-causing code and the `last_error()` or `last_trace()` call, to fulfill
#' the requirement of being in separate chunks:
#' To use [rlang::last_error()] or [rlang::last_trace()] within a reprex,
#' you must place them in a different "chunk" to the code that generates an
#' error. The easiest way to do is to insert a line containing the special
#' comment `#'` after error-causing code:

#' ``` r
#' f <- function() rlang::abort('foo')
Expand Down
1 change: 0 additions & 1 deletion R/reprex_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ reprex_opts <- function(venue = "gh") {
```{{r reprex-options, include = FALSE}}
options(
keep.source = TRUE,
rlang_backtrace_on_error_report = "full",
crayon.enabled = FALSE,
reprex.current_venue = "{venue}"
)
Expand Down
1 change: 0 additions & 1 deletion R/reprex_render.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ reprex_render_impl <- function(input,
# should be kept in sync with what reprex_opts() sets
opts_to_safeguard <- options(
"keep.source",
"rlang_backtrace_on_error_report",
"crayon.enabled"
)
withr::defer(options(opts_to_safeguard))
Expand Down
13 changes: 4 additions & 9 deletions man/reprex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.