Skip to content
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: 2 additions & 2 deletions R/addins.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ set_style_transformers <- function() {
current_style
)
if (!is.null(new_style)) {
parsed_new_style <- rlang::with_handlers(
parsed_new_style <- rlang::try_fetch(
{
transformers <- eval(parse(text = new_style))
style_text(
Expand Down Expand Up @@ -208,7 +208,7 @@ communicate_addins_style_transformers <- function() {
#' [make_transformer()].
#' @keywords internal
try_transform_as_r_file <- function(context, transformer) {
rlang::with_handlers(
rlang::try_fetch(
transformer(context$contents),
error = function(e) {
preamble_for_unsaved <- paste(
Expand Down
4 changes: 2 additions & 2 deletions R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ transform_utf8 <- function(path, fun, dry) {
#' @keywords internal
transform_utf8_one <- function(path, fun, dry) {
rlang::arg_match(dry, c("on", "off", "fail"))
rlang::with_handlers(
rlang::try_fetch(
{
file_with_info <- read_utf8(path)
# only write back when changed OR when there was a missing newline
Expand Down Expand Up @@ -70,7 +70,7 @@ transform_utf8_one <- function(path, fun, dry) {
#' @param path A path to a file to read.
#' @keywords internal
read_utf8 <- function(path) {
out <- rlang::with_handlers(
out <- rlang::try_fetch(
read_utf8_bare(path),
warning = function(w) w,
error = function(e) e
Expand Down
2 changes: 1 addition & 1 deletion R/parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#'
#' styler:::parse_safely("a + 3 -4 -> \n glück + 1")
parse_safely <- function(text, ...) {
tried_parsing <- rlang::with_handlers(
tried_parsing <- rlang::try_fetch(
parse(text = text, ...),
error = function(e) e,
warning = function(w) w
Expand Down
4 changes: 2 additions & 2 deletions R/roxygen-examples-parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ parse_roxygen <- function(roxygen) {
#' )
#' @keywords internal
roxygen_remove_extra_brace <- function(parsed) {
parsed <- rlang::with_handlers(
parsed <- rlang::try_fetch(
{
parse(text = paste0(gsub("^\\\\[[:alpha:]]*", "", parsed), collapse = ""))
parsed
Expand All @@ -92,7 +92,7 @@ roxygen_remove_extra_brace <- function(parsed) {
parsed <- parsed[-last(linebreak)]
}
# try if can be parsed (need remve dontrun)
worth_trying_to_remove_brace <- rlang::with_handlers(
worth_trying_to_remove_brace <- rlang::try_fetch(
{
# this will error informatively
parse(text = gsub("^\\\\[[:alpha:]]+", "", parsed))
Expand Down
2 changes: 1 addition & 1 deletion R/roxygen-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ style_roxygen_code_example_one <- function(example_one,
) %>%
flatten_chr()
if (bare$example_type == "examplesIf") {
rlang::with_handlers(
rlang::try_fetch(
parse_text(unmasked[1L]),
error = function(e) {
abort(paste0(
Expand Down
2 changes: 1 addition & 1 deletion R/transform-files.R
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ parse_tree_must_be_identical <- function(transformers) {
#' @keywords internal
verify_roundtrip <- function(old_text, new_text, parsable_only = FALSE) {
if (parsable_only) {
rlang::with_handlers(
rlang::try_fetch(
parse_safely(new_text),
error = function(e) {
rlang::abort(paste0(
Expand Down
107 changes: 73 additions & 34 deletions tests/testthat/curly-curly/mixed-in_tree

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

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

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

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

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

Loading