From ad6f94857e1b7b34aa41579e997facde05c787b6 Mon Sep 17 00:00:00 2001 From: Marta Alcalde-Herraiz Date: Thu, 15 Aug 2024 12:12:38 -0700 Subject: [PATCH 1/7] add allow_na argument to check character() --- R/standalone-types-check.R | 9 +++++++-- tests/testthat/_snaps/arg.md | 2 +- tests/testthat/test-standalone-types-check.R | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/R/standalone-types-check.R b/R/standalone-types-check.R index 90a889f1b..e8d9c8e60 100644 --- a/R/standalone-types-check.R +++ b/R/standalone-types-check.R @@ -459,11 +459,16 @@ check_formula <- function(x, check_character <- function(x, ..., + allow_na = FALSE, allow_null = FALSE, arg = caller_arg(x), call = caller_env()) { + if (!missing(x)) { - if (is_character(x)) { + if (is_character(x) & allow_na) { + return(invisible(NULL)) + } + if(is.character(x) & !(TRUE %in% is.na(x)) & !allow_na){ return(invisible(NULL)) } if (allow_null && is_null(x)) { @@ -475,7 +480,7 @@ check_character <- function(x, x, "a character vector", ..., - allow_na = FALSE, + allow_na = allow_na, allow_null = allow_null, arg = arg, call = call diff --git a/tests/testthat/_snaps/arg.md b/tests/testthat/_snaps/arg.md index a27951d92..74095fd98 100644 --- a/tests/testthat/_snaps/arg.md +++ b/tests/testthat/_snaps/arg.md @@ -263,7 +263,7 @@ Output Error in `f()`: - ! `x` must be a single string, not a character `NA`. + ! `x` must be a character vector, not a character `NA`. Code (expect_error(f(chr()))) Output diff --git a/tests/testthat/test-standalone-types-check.R b/tests/testthat/test-standalone-types-check.R index ce0a3dc0a..3f2dbe3b7 100644 --- a/tests/testthat/test-standalone-types-check.R +++ b/tests/testthat/test-standalone-types-check.R @@ -152,11 +152,16 @@ test_that("`check_environment()` checks", { test_that("`check_character()` checks", { expect_null(check_character("")) - expect_null(check_character(na_chr)) + expect_error(check_character(na_chr)) expect_null(check_character(chr())) expect_null(check_character("foo")) expect_null(check_character(letters)) + expect_null(check_character(NULL, allow_null = TRUE)) + expect_error(check_character(NULL, allow_null = FALSE)) + + expect_error(check_character(c("a",NA))) + expect_null(check_character(c("a",NA), allow_na = TRUE)) expect_snapshot({ err(checker(, check_character)) From e5bb6c258cb8b73775886ae4668659c5871b2334 Mon Sep 17 00:00:00 2001 From: Marta Alcalde-Herraiz Date: Thu, 15 Aug 2024 14:17:50 -0700 Subject: [PATCH 2/7] apply changes --- R/standalone-types-check.R | 8 +++++++- tests/testthat/_snaps/arg.md | 4 ++-- tests/testthat/_snaps/cnd-abort.md | 8 ++++++++ tests/testthat/_snaps/standalone-types-check.md | 12 ++++++++++++ tests/testthat/test-standalone-types-check.R | 7 ++----- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/R/standalone-types-check.R b/R/standalone-types-check.R index e8d9c8e60..d4cdc314e 100644 --- a/R/standalone-types-check.R +++ b/R/standalone-types-check.R @@ -468,14 +468,20 @@ check_character <- function(x, if (is_character(x) & allow_na) { return(invisible(NULL)) } - if(is.character(x) & !(TRUE %in% is.na(x)) & !allow_na){ + + if (is_character(x)){ + if (!allow_na && any(is.na(x))) { + cli::cli_abort("`x` must not contain NA values.", call = caller_env()) + } return(invisible(NULL)) } + if (allow_null && is_null(x)) { return(invisible(NULL)) } } + stop_input_type( x, "a character vector", diff --git a/tests/testthat/_snaps/arg.md b/tests/testthat/_snaps/arg.md index 74095fd98..390010801 100644 --- a/tests/testthat/_snaps/arg.md +++ b/tests/testthat/_snaps/arg.md @@ -262,8 +262,8 @@ (expect_error(f(na_chr))) Output - Error in `f()`: - ! `x` must be a character vector, not a character `NA`. + Error in `arg_match()`: + ! `x` must not contain NA values. Code (expect_error(f(chr()))) Output diff --git a/tests/testthat/_snaps/cnd-abort.md b/tests/testthat/_snaps/cnd-abort.md index ba16518c8..84757534f 100644 --- a/tests/testthat/_snaps/cnd-abort.md +++ b/tests/testthat/_snaps/cnd-abort.md @@ -101,6 +101,8 @@ Code cat_line(branch_depth_0) Output + Warning message: + package ‘rlang’ was built under R version 4.3.3 Error: ! foo Backtrace: @@ -109,6 +111,8 @@ Code cat_line(full_depth_0) Output + Warning message: + package ‘rlang’ was built under R version 4.3.3 Error: ! foo Backtrace: @@ -118,6 +122,8 @@ Code cat_line(branch_depth_1) Output + Warning message: + package ‘rlang’ was built under R version 4.3.3 Error in `f()`: ! foo Backtrace: @@ -126,6 +132,8 @@ Code cat_line(full_depth_1) Output + Warning message: + package ‘rlang’ was built under R version 4.3.3 Error in `f()`: ! foo Backtrace: diff --git a/tests/testthat/_snaps/standalone-types-check.md b/tests/testthat/_snaps/standalone-types-check.md index 16af3ed25..1e6b606e9 100644 --- a/tests/testthat/_snaps/standalone-types-check.md +++ b/tests/testthat/_snaps/standalone-types-check.md @@ -438,6 +438,18 @@ Error in `checker()`: ! `foo` must be a character vector, not `NA`. + Code + err(checker(na_chr, check_character)) + Output + + Error in `checker()`: + ! `x` must not contain NA values. + Code + err(checker(c("a", NA), check_character)) + Output + + Error in `checker()`: + ! `x` must not contain NA values. Code err(checker(1, check_character)) Output diff --git a/tests/testthat/test-standalone-types-check.R b/tests/testthat/test-standalone-types-check.R index 3f2dbe3b7..745c08c48 100644 --- a/tests/testthat/test-standalone-types-check.R +++ b/tests/testthat/test-standalone-types-check.R @@ -152,21 +152,18 @@ test_that("`check_environment()` checks", { test_that("`check_character()` checks", { expect_null(check_character("")) - expect_error(check_character(na_chr)) expect_null(check_character(chr())) expect_null(check_character("foo")) expect_null(check_character(letters)) - expect_null(check_character(NULL, allow_null = TRUE)) - expect_error(check_character(NULL, allow_null = FALSE)) - - expect_error(check_character(c("a",NA))) expect_null(check_character(c("a",NA), allow_na = TRUE)) expect_snapshot({ err(checker(, check_character)) err(checker(NULL, check_character)) err(checker(NA, check_character)) + err(checker(na_chr, check_character)) + err(checker(c("a", NA), check_character)) err(checker(1, check_character)) err(checker(list("foo", "bar"), check_character, allow_null = TRUE)) }) From 282eb9a9bc3784e82de726322d7d35a8069c1e7b Mon Sep 17 00:00:00 2001 From: Marta Alcalde-Herraiz Date: Thu, 15 Aug 2024 14:34:19 -0700 Subject: [PATCH 3/7] Update cnd-abort.md --- tests/testthat/_snaps/cnd-abort.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/testthat/_snaps/cnd-abort.md b/tests/testthat/_snaps/cnd-abort.md index 84757534f..ed9753b1d 100644 --- a/tests/testthat/_snaps/cnd-abort.md +++ b/tests/testthat/_snaps/cnd-abort.md @@ -122,8 +122,6 @@ Code cat_line(branch_depth_1) Output - Warning message: - package ‘rlang’ was built under R version 4.3.3 Error in `f()`: ! foo Backtrace: @@ -132,8 +130,6 @@ Code cat_line(full_depth_1) Output - Warning message: - package ‘rlang’ was built under R version 4.3.3 Error in `f()`: ! foo Backtrace: From 7e871f5ca3bf092c4369ac18a7faa5c89bd106e8 Mon Sep 17 00:00:00 2001 From: Marta Alcalde-Herraiz Date: Thu, 15 Aug 2024 14:44:37 -0700 Subject: [PATCH 4/7] Update snapshots --- tests/testthat/_snaps/cnd-abort.md | 525 ++++++++++----------- tests/testthat/_snaps/current/cnd-abort.md | 128 ++--- 2 files changed, 322 insertions(+), 331 deletions(-) diff --git a/tests/testthat/_snaps/cnd-abort.md b/tests/testthat/_snaps/cnd-abort.md index ed9753b1d..9a583c9e0 100644 --- a/tests/testthat/_snaps/cnd-abort.md +++ b/tests/testthat/_snaps/cnd-abort.md @@ -101,8 +101,6 @@ Code cat_line(branch_depth_0) Output - Warning message: - package ‘rlang’ was built under R version 4.3.3 Error: ! foo Backtrace: @@ -111,8 +109,6 @@ Code cat_line(full_depth_0) Output - Warning message: - package ‘rlang’ was built under R version 4.3.3 Error: ! foo Backtrace: @@ -183,7 +179,7 @@ --- Backtrace: x - 1. +-rlang:::catch_error(f()) + 1. +-catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -191,9 +187,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-rlang (local) f() - 10. \-rlang (local) g() - 11. \-rlang (local) h() + 9. \-f() + 10. \-g() + 11. \-h() Code # From `last_error()` print(last_error()) @@ -204,7 +200,7 @@ --- Backtrace: x - 1. +-rlang:::catch_error(f()) + 1. +-catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -212,9 +208,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-rlang (local) f() - 10. \-rlang (local) g() - 11. \-rlang (local) h() + 9. \-f() + 10. \-g() + 11. \-h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. Code # Saved from `last_error()` @@ -229,7 +225,7 @@ --- Backtrace: x - 1. +-rlang:::catch_error(f()) + 1. +-catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -237,9 +233,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-rlang (local) f() - 10. \-rlang (local) g() - 11. \-rlang (local) h() + 9. \-f() + 10. \-g() + 11. \-h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. Code # Saved from `last_error()`, but no longer last @@ -254,7 +250,7 @@ --- Backtrace: x - 1. +-rlang:::catch_error(f()) + 1. +-catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -262,9 +258,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-rlang (local) f() - 10. \-rlang (local) g() - 11. \-rlang (local) h() + 9. \-f() + 10. \-g() + 11. \-h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. # Backtrace on rethrow: stop() - tryCatch() @@ -281,7 +277,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -289,9 +285,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -304,7 +300,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -312,9 +308,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -327,7 +323,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -335,9 +331,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -350,7 +346,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -358,9 +354,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) # Backtrace on rethrow: stop() - withCallingHandlers() @@ -376,7 +372,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -384,13 +380,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -404,7 +400,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -412,13 +408,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -432,7 +428,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -440,13 +436,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -460,7 +456,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -468,13 +464,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::stop("low-level") # Backtrace on rethrow: stop() - try_fetch() @@ -491,7 +487,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -499,18 +495,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -524,7 +520,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -532,18 +528,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -557,7 +553,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -565,18 +561,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -590,7 +586,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -598,18 +594,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::stop("low-level") # Backtrace on rethrow: abort() - tryCatch() @@ -626,7 +622,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -634,16 +630,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-rlang (local) low1() - 18. \-rlang (local) low2() - 19. \-rlang (local) low3() + 17. \-low1() + 18. \-low2() + 19. \-low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -656,7 +652,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -664,16 +660,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-rlang (local) low1() - 18. \-rlang (local) low2() - 19. \-rlang (local) low3() + 17. \-low1() + 18. \-low2() + 19. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -686,7 +682,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -694,16 +690,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-rlang (local) low1() - 18. \-rlang (local) low2() - 19. \-rlang (local) low3() + 17. \-low1() + 18. \-low2() + 19. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -716,7 +712,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -724,16 +720,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-rlang (local) low1() - 18. \-rlang (local) low2() - 19. \-rlang (local) low3() + 17. \-low1() + 18. \-low2() + 19. \-low3() # Backtrace on rethrow: abort() - withCallingHandlers() @@ -749,7 +745,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -757,13 +753,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -776,7 +772,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -784,13 +780,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -803,7 +799,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -811,13 +807,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -830,7 +826,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -838,13 +834,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() # Backtrace on rethrow: abort() - try_fetch() @@ -860,7 +856,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -868,18 +864,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -892,7 +888,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -900,18 +896,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -924,7 +920,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -932,18 +928,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -956,7 +952,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -964,18 +960,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() # Backtrace on rethrow: warn = 2 - tryCatch() @@ -991,7 +987,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -999,9 +995,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -1014,7 +1010,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1022,9 +1018,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -1037,7 +1033,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1045,9 +1041,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -1060,7 +1056,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1068,9 +1064,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) # Backtrace on rethrow: warn = 2 - withCallingHandlers() @@ -1086,7 +1082,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1094,13 +1090,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -1114,7 +1110,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1122,13 +1118,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -1142,7 +1138,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1150,13 +1146,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -1170,7 +1166,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1178,13 +1174,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-base::withCallingHandlers(...) - 14. \-rlang (local) low1() - 15. \-rlang (local) low2() - 16. \-rlang (local) low3() + 14. \-low1() + 15. \-low2() + 16. \-low3() 17. \-base::warning("low-level") # Backtrace on rethrow: warn = 2 - try_fetch() @@ -1201,7 +1197,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1209,18 +1205,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -1234,7 +1230,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1242,18 +1238,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = TRUE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -1267,7 +1263,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1275,18 +1271,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = TRUE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -1300,7 +1296,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1308,18 +1304,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) - 11. \-rlang (local) high2(...) - 12. \-rlang (local) high3(...) + 10. \-high1(chain = FALSE, stop_helper = FALSE) + 11. \-high2(...) + 12. \-high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-rlang (local) low1() - 20. \-rlang (local) low2() - 21. \-rlang (local) low3() + 19. \-low1() + 20. \-low2() + 21. \-low3() 22. \-base::warning("low-level") # abort() displays call in error prefix @@ -1583,8 +1579,7 @@ Error: ! foo x bar - i This is an internal error that was detected in the rlang package. - Please report it at with a reprex () and the full backtrace. + i This is an internal error, please report it to the package authors. Code err(abort("foo", body = c(x = "bar"), .internal = TRUE)) Output @@ -1592,8 +1587,7 @@ Error: ! foo x bar - i This is an internal error that was detected in the rlang package. - Please report it at with a reprex () and the full backtrace. + i This is an internal error, please report it to the package authors. # setting `.internal` adds footer bullet (fallback) @@ -1604,8 +1598,7 @@ Error: ! foo x bar - i This is an internal error that was detected in the rlang package. - Please report it at with a reprex () and the full backtrace. + i This is an internal error, please report it to the package authors. Code err(abort("foo", body = c(x = "bar"), .internal = TRUE)) Output @@ -1613,8 +1606,7 @@ Error: ! foo x bar - i This is an internal error that was detected in the rlang package. - Please report it at with a reprex () and the full backtrace. + i This is an internal error, please report it to the package authors. # must pass character `body` when `message` is > 1 @@ -1700,8 +1692,7 @@ Error in `f()`: ! foo - i This is an internal error that was detected in the rlang package. - Please report it at with a reprex () and the full backtrace. + i This is an internal error, please report it to the package authors. Code err(abort("foo", footer = "bar", .internal = TRUE, call = quote(f()))) Output @@ -1728,16 +1719,16 @@ Backtrace: x 1. +-base::print(err(foo())) - 2. +-rlang:::err(foo()) + 2. +-err(foo()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-rlang (local) foo() - 10. \-rlang (local) bar() - 11. \-rlang (local) baz() + 9. \-foo() + 10. \-bar() + 11. \-baz() # if `call` is older than handler caller, use that as bottom @@ -1762,7 +1753,7 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. \-rlang (local) f() + 8. \-f() Code low_level <- (function(call) { abort("Tilt.", call = list(NULL, frame = call)) @@ -1784,7 +1775,7 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. \-rlang (local) f() + 8. \-f() # base causal errors include full user backtrace @@ -1806,15 +1797,15 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. +-rlang (local) my_verb(add(1, "")) - 9. | \-rlang (local) with_chained_errors(expr) + 8. +-my_verb(add(1, "")) + 9. | \-with_chained_errors(expr) 10. | \-rlang::try_fetch(...) 11. | +-base::tryCatch(...) 12. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 13. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 15. | \-base::withCallingHandlers(...) - 16. \-rlang (local) add(1, "") + 16. \-add(1, "") # can supply header method via `message` diff --git a/tests/testthat/_snaps/current/cnd-abort.md b/tests/testthat/_snaps/current/cnd-abort.md index 30630b86a..58cde79a2 100644 --- a/tests/testthat/_snaps/current/cnd-abort.md +++ b/tests/testthat/_snaps/current/cnd-abort.md @@ -18,14 +18,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-rlang (local) high1() - 8. \-rlang (local) high2() - 9. \-rlang (local) high3() - 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) + 7. \-high1() + 8. \-high2() + 9. \-high3() + 10. +-wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-rlang (local) low1() - 13. \-rlang (local) low2() - 14. \-rlang (local) low3() + 12. \-low1() + 13. \-low2() + 14. \-low3() Code summary(err) Output @@ -43,14 +43,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-rlang (local) high1() - 8. \-rlang (local) high2() - 9. \-rlang (local) high3() - 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) + 7. \-high1() + 8. \-high2() + 9. \-high3() + 10. +-wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-rlang (local) low1() - 13. \-rlang (local) low2() - 14. \-rlang (local) low3() + 12. \-low1() + 13. \-low2() + 14. \-low3() --- @@ -72,14 +72,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-rlang (local) high1() - 8. \-rlang (local) high2() - 9. \-rlang (local) high3() - 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) + 7. \-high1() + 8. \-high2() + 9. \-high3() + 10. +-wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-rlang (local) low1() - 13. \-rlang (local) low2() - 14. \-rlang (local) low3() + 12. \-low1() + 13. \-low2() + 14. \-low3() 15. \-rlang (local) fail(NULL, "Low-level message") Code summary(err) @@ -98,14 +98,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-rlang (local) high1() - 8. \-rlang (local) high2() - 9. \-rlang (local) high3() - 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) + 7. \-high1() + 8. \-high2() + 9. \-high3() + 10. +-wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-rlang (local) low1() - 13. \-rlang (local) low2() - 14. \-rlang (local) low3() + 12. \-low1() + 13. \-low2() + 14. \-low3() 15. \-rlang (local) fail(NULL, "Low-level message") # `parent = NA` signals a non-chained rethrow @@ -126,23 +126,23 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-rlang:::err(ff()) + 2. +-err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. +-rlang (local) ff() - 10. | \-rlang (local) gg() - 11. | \-rlang (local) hh() + 9. +-ff() + 10. | \-gg() + 11. | \-hh() 12. | +-base::withCallingHandlers(...) - 13. | \-rlang (local) foo() - 14. | \-rlang (local) bar() - 15. | \-rlang (local) baz() + 13. | \-foo() + 14. | \-bar() + 15. | \-baz() 16. | \-base::stop("bar") 17. \-base::.handleSimpleError(``, "bar", base::quote(baz())) - 18. \-rlang (local) h(simpleError(msg, call)) + 18. \-h(simpleError(msg, call)) Code # Missing parent allows correct trace bottom hh <- (function() { @@ -159,20 +159,20 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-rlang:::err(ff()) + 2. +-err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-rlang (local) ff() - 10. \-rlang (local) gg() - 11. \-rlang (local) hh() + 9. \-ff() + 10. \-gg() + 11. \-hh() 12. +-base::withCallingHandlers(...) - 13. \-rlang (local) foo() - 14. \-rlang (local) bar() - 15. \-rlang (local) baz() + 13. \-foo() + 14. \-bar() + 15. \-baz() 16. \-base::stop("bar") Code # Wrapped handler @@ -190,20 +190,20 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-rlang:::err(ff()) + 2. +-err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-rlang (local) ff() - 10. \-rlang (local) gg() - 11. \-rlang (local) hh() + 9. \-ff() + 10. \-gg() + 11. \-hh() 12. +-base::withCallingHandlers(foo(), error = function(cnd) handler1(cnd)) - 13. \-rlang (local) foo() - 14. \-rlang (local) bar() - 15. \-rlang (local) baz() + 13. \-foo() + 14. \-bar() + 15. \-baz() 16. \-base::stop("bar") Code # Wrapped handler, `try_fetch()` @@ -219,25 +219,25 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-rlang:::err(ff()) + 2. +-err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-rlang (local) ff() - 10. \-rlang (local) gg() - 11. \-rlang (local) hh() + 9. \-ff() + 10. \-gg() + 11. \-hh() 12. +-rlang::try_fetch(foo(), error = function(cnd) handler1(cnd)) 13. | +-base::tryCatch(...) 14. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 17. | \-base::withCallingHandlers(...) - 18. \-rlang (local) foo() - 19. \-rlang (local) bar() - 20. \-rlang (local) baz() + 18. \-foo() + 19. \-bar() + 20. \-baz() 21. \-base::stop("bar") Code # Wrapped handler, incorrect `call` @@ -253,19 +253,19 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-rlang:::err(ff()) + 2. +-err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-rlang (local) ff() - 10. \-rlang (local) gg() - 11. \-rlang (local) hh() + 9. \-ff() + 10. \-gg() + 11. \-hh() 12. +-base::withCallingHandlers(foo(), error = handler1) - 13. \-rlang (local) foo() - 14. \-rlang (local) bar() - 15. \-rlang (local) baz() + 13. \-foo() + 14. \-bar() + 15. \-baz() 16. \-base::stop("bar") From 9abd31c230d62e790f44d9eec2af8ff030f7ecf3 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Thu, 15 Aug 2024 17:31:43 -0700 Subject: [PATCH 5/7] Update snapshots --- tests/testthat/_snaps/cnd-abort.md | 521 +++++++++++---------- tests/testthat/_snaps/current/cnd-abort.md | 128 ++--- 2 files changed, 327 insertions(+), 322 deletions(-) diff --git a/tests/testthat/_snaps/cnd-abort.md b/tests/testthat/_snaps/cnd-abort.md index 9a583c9e0..ba16518c8 100644 --- a/tests/testthat/_snaps/cnd-abort.md +++ b/tests/testthat/_snaps/cnd-abort.md @@ -179,7 +179,7 @@ --- Backtrace: x - 1. +-catch_error(f()) + 1. +-rlang:::catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -187,9 +187,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-f() - 10. \-g() - 11. \-h() + 9. \-rlang (local) f() + 10. \-rlang (local) g() + 11. \-rlang (local) h() Code # From `last_error()` print(last_error()) @@ -200,7 +200,7 @@ --- Backtrace: x - 1. +-catch_error(f()) + 1. +-rlang:::catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -208,9 +208,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-f() - 10. \-g() - 11. \-h() + 9. \-rlang (local) f() + 10. \-rlang (local) g() + 11. \-rlang (local) h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. Code # Saved from `last_error()` @@ -225,7 +225,7 @@ --- Backtrace: x - 1. +-catch_error(f()) + 1. +-rlang:::catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -233,9 +233,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-f() - 10. \-g() - 11. \-h() + 9. \-rlang (local) f() + 10. \-rlang (local) g() + 11. \-rlang (local) h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. Code # Saved from `last_error()`, but no longer last @@ -250,7 +250,7 @@ --- Backtrace: x - 1. +-catch_error(f()) + 1. +-rlang:::catch_error(f()) 2. | \-rlang::catch_cnd(expr, "error") 3. | +-rlang::eval_bare(...) 4. | +-base::tryCatch(...) @@ -258,9 +258,9 @@ 6. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 8. | \-base::force(expr) - 9. \-f() - 10. \-g() - 11. \-h() + 9. \-rlang (local) f() + 10. \-rlang (local) g() + 11. \-rlang (local) h() Run rlang::last_trace(drop = FALSE) to see 1 hidden frame. # Backtrace on rethrow: stop() - tryCatch() @@ -277,7 +277,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -285,9 +285,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -300,7 +300,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -308,9 +308,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -323,7 +323,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -331,9 +331,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -346,7 +346,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -354,9 +354,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) # Backtrace on rethrow: stop() - withCallingHandlers() @@ -372,7 +372,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -380,13 +380,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -400,7 +400,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -408,13 +408,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -428,7 +428,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -436,13 +436,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -456,7 +456,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -464,13 +464,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::stop("low-level") # Backtrace on rethrow: stop() - try_fetch() @@ -487,7 +487,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -495,18 +495,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -520,7 +520,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -528,18 +528,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -553,7 +553,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -561,18 +561,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::stop("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -586,7 +586,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -594,18 +594,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::stop("low-level") # Backtrace on rethrow: abort() - tryCatch() @@ -622,7 +622,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -630,16 +630,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-low1() - 18. \-low2() - 19. \-low3() + 17. \-rlang (local) low1() + 18. \-rlang (local) low2() + 19. \-rlang (local) low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -652,7 +652,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -660,16 +660,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-low1() - 18. \-low2() - 19. \-low3() + 17. \-rlang (local) low1() + 18. \-rlang (local) low2() + 19. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -682,7 +682,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -690,16 +690,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-low1() - 18. \-low2() - 19. \-low3() + 17. \-rlang (local) low1() + 18. \-rlang (local) low2() + 19. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -712,7 +712,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -720,16 +720,16 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::tryCatch(...) 14. | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | \-base (local) doTryCatch(return(expr), name, parentenv, handler) - 17. \-low1() - 18. \-low2() - 19. \-low3() + 17. \-rlang (local) low1() + 18. \-rlang (local) low2() + 19. \-rlang (local) low3() # Backtrace on rethrow: abort() - withCallingHandlers() @@ -745,7 +745,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -753,13 +753,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -772,7 +772,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -780,13 +780,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -799,7 +799,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -807,13 +807,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -826,7 +826,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -834,13 +834,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() # Backtrace on rethrow: abort() - try_fetch() @@ -856,7 +856,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -864,18 +864,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -888,7 +888,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -896,18 +896,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -920,7 +920,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -928,18 +928,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -952,7 +952,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -960,18 +960,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() # Backtrace on rethrow: warn = 2 - tryCatch() @@ -987,7 +987,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -995,9 +995,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) Output @@ -1010,7 +1010,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1018,9 +1018,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) Output @@ -1033,7 +1033,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1041,9 +1041,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) Output @@ -1056,7 +1056,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1064,9 +1064,9 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) # Backtrace on rethrow: warn = 2 - withCallingHandlers() @@ -1082,7 +1082,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1090,13 +1090,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -1110,7 +1110,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1118,13 +1118,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -1138,7 +1138,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1146,13 +1146,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -1166,7 +1166,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1174,13 +1174,13 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-base::withCallingHandlers(...) - 14. \-low1() - 15. \-low2() - 16. \-low3() + 14. \-rlang (local) low1() + 15. \-rlang (local) low2() + 16. \-rlang (local) low3() 17. \-base::warning("low-level") # Backtrace on rethrow: warn = 2 - try_fetch() @@ -1197,7 +1197,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1205,18 +1205,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) @@ -1230,7 +1230,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = TRUE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = TRUE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = TRUE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1238,18 +1238,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = TRUE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = TRUE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) @@ -1263,7 +1263,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = TRUE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = TRUE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = TRUE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1271,18 +1271,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = TRUE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = TRUE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::warning("low-level") Code print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) @@ -1296,7 +1296,7 @@ Backtrace: x 1. +-base::print(catch_error(high1(chain = FALSE, stop_helper = FALSE))) - 2. +-catch_error(high1(chain = FALSE, stop_helper = FALSE)) + 2. +-rlang:::catch_error(high1(chain = FALSE, stop_helper = FALSE)) 3. | \-rlang::catch_cnd(expr, "error") 4. | +-rlang::eval_bare(...) 5. | +-base::tryCatch(...) @@ -1304,18 +1304,18 @@ 7. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 9. | \-base::force(expr) - 10. \-high1(chain = FALSE, stop_helper = FALSE) - 11. \-high2(...) - 12. \-high3(...) + 10. \-rlang (local) high1(chain = FALSE, stop_helper = FALSE) + 11. \-rlang (local) high2(...) + 12. \-rlang (local) high3(...) 13. +-rlang::try_fetch(...) 14. | +-base::tryCatch(...) 15. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 16. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 18. | \-base::withCallingHandlers(...) - 19. \-low1() - 20. \-low2() - 21. \-low3() + 19. \-rlang (local) low1() + 20. \-rlang (local) low2() + 21. \-rlang (local) low3() 22. \-base::warning("low-level") # abort() displays call in error prefix @@ -1579,7 +1579,8 @@ Error: ! foo x bar - i This is an internal error, please report it to the package authors. + i This is an internal error that was detected in the rlang package. + Please report it at with a reprex () and the full backtrace. Code err(abort("foo", body = c(x = "bar"), .internal = TRUE)) Output @@ -1587,7 +1588,8 @@ Error: ! foo x bar - i This is an internal error, please report it to the package authors. + i This is an internal error that was detected in the rlang package. + Please report it at with a reprex () and the full backtrace. # setting `.internal` adds footer bullet (fallback) @@ -1598,7 +1600,8 @@ Error: ! foo x bar - i This is an internal error, please report it to the package authors. + i This is an internal error that was detected in the rlang package. + Please report it at with a reprex () and the full backtrace. Code err(abort("foo", body = c(x = "bar"), .internal = TRUE)) Output @@ -1606,7 +1609,8 @@ Error: ! foo x bar - i This is an internal error, please report it to the package authors. + i This is an internal error that was detected in the rlang package. + Please report it at with a reprex () and the full backtrace. # must pass character `body` when `message` is > 1 @@ -1692,7 +1696,8 @@ Error in `f()`: ! foo - i This is an internal error, please report it to the package authors. + i This is an internal error that was detected in the rlang package. + Please report it at with a reprex () and the full backtrace. Code err(abort("foo", footer = "bar", .internal = TRUE, call = quote(f()))) Output @@ -1719,16 +1724,16 @@ Backtrace: x 1. +-base::print(err(foo())) - 2. +-err(foo()) + 2. +-rlang:::err(foo()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-foo() - 10. \-bar() - 11. \-baz() + 9. \-rlang (local) foo() + 10. \-rlang (local) bar() + 11. \-rlang (local) baz() # if `call` is older than handler caller, use that as bottom @@ -1753,7 +1758,7 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. \-f() + 8. \-rlang (local) f() Code low_level <- (function(call) { abort("Tilt.", call = list(NULL, frame = call)) @@ -1775,7 +1780,7 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. \-f() + 8. \-rlang (local) f() # base causal errors include full user backtrace @@ -1797,15 +1802,15 @@ 5. | +-testthat (local) .capture(...) 6. | | \-base::withCallingHandlers(...) 7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 8. +-my_verb(add(1, "")) - 9. | \-with_chained_errors(expr) + 8. +-rlang (local) my_verb(add(1, "")) + 9. | \-rlang (local) with_chained_errors(expr) 10. | \-rlang::try_fetch(...) 11. | +-base::tryCatch(...) 12. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 13. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 15. | \-base::withCallingHandlers(...) - 16. \-add(1, "") + 16. \-rlang (local) add(1, "") # can supply header method via `message` diff --git a/tests/testthat/_snaps/current/cnd-abort.md b/tests/testthat/_snaps/current/cnd-abort.md index 58cde79a2..30630b86a 100644 --- a/tests/testthat/_snaps/current/cnd-abort.md +++ b/tests/testthat/_snaps/current/cnd-abort.md @@ -18,14 +18,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-high1() - 8. \-high2() - 9. \-high3() - 10. +-wch(low1(), error = function(err) handler1(err)) + 7. \-rlang (local) high1() + 8. \-rlang (local) high2() + 9. \-rlang (local) high3() + 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-low1() - 13. \-low2() - 14. \-low3() + 12. \-rlang (local) low1() + 13. \-rlang (local) low2() + 14. \-rlang (local) low3() Code summary(err) Output @@ -43,14 +43,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-high1() - 8. \-high2() - 9. \-high3() - 10. +-wch(low1(), error = function(err) handler1(err)) + 7. \-rlang (local) high1() + 8. \-rlang (local) high2() + 9. \-rlang (local) high3() + 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-low1() - 13. \-low2() - 14. \-low3() + 12. \-rlang (local) low1() + 13. \-rlang (local) low2() + 14. \-rlang (local) low3() --- @@ -72,14 +72,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-high1() - 8. \-high2() - 9. \-high3() - 10. +-wch(low1(), error = function(err) handler1(err)) + 7. \-rlang (local) high1() + 8. \-rlang (local) high2() + 9. \-rlang (local) high3() + 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-low1() - 13. \-low2() - 14. \-low3() + 12. \-rlang (local) low1() + 13. \-rlang (local) low2() + 14. \-rlang (local) low3() 15. \-rlang (local) fail(NULL, "Low-level message") Code summary(err) @@ -98,14 +98,14 @@ 4. | +-testthat (local) .capture(...) 5. | | \-base::withCallingHandlers(...) 6. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 7. \-high1() - 8. \-high2() - 9. \-high3() - 10. +-wch(low1(), error = function(err) handler1(err)) + 7. \-rlang (local) high1() + 8. \-rlang (local) high2() + 9. \-rlang (local) high3() + 10. +-rlang (local) wch(low1(), error = function(err) handler1(err)) 11. | \-base::withCallingHandlers(expr, ...) - 12. \-low1() - 13. \-low2() - 14. \-low3() + 12. \-rlang (local) low1() + 13. \-rlang (local) low2() + 14. \-rlang (local) low3() 15. \-rlang (local) fail(NULL, "Low-level message") # `parent = NA` signals a non-chained rethrow @@ -126,23 +126,23 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-err(ff()) + 2. +-rlang:::err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. +-ff() - 10. | \-gg() - 11. | \-hh() + 9. +-rlang (local) ff() + 10. | \-rlang (local) gg() + 11. | \-rlang (local) hh() 12. | +-base::withCallingHandlers(...) - 13. | \-foo() - 14. | \-bar() - 15. | \-baz() + 13. | \-rlang (local) foo() + 14. | \-rlang (local) bar() + 15. | \-rlang (local) baz() 16. | \-base::stop("bar") 17. \-base::.handleSimpleError(``, "bar", base::quote(baz())) - 18. \-h(simpleError(msg, call)) + 18. \-rlang (local) h(simpleError(msg, call)) Code # Missing parent allows correct trace bottom hh <- (function() { @@ -159,20 +159,20 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-err(ff()) + 2. +-rlang:::err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-ff() - 10. \-gg() - 11. \-hh() + 9. \-rlang (local) ff() + 10. \-rlang (local) gg() + 11. \-rlang (local) hh() 12. +-base::withCallingHandlers(...) - 13. \-foo() - 14. \-bar() - 15. \-baz() + 13. \-rlang (local) foo() + 14. \-rlang (local) bar() + 15. \-rlang (local) baz() 16. \-base::stop("bar") Code # Wrapped handler @@ -190,20 +190,20 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-err(ff()) + 2. +-rlang:::err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-ff() - 10. \-gg() - 11. \-hh() + 9. \-rlang (local) ff() + 10. \-rlang (local) gg() + 11. \-rlang (local) hh() 12. +-base::withCallingHandlers(foo(), error = function(cnd) handler1(cnd)) - 13. \-foo() - 14. \-bar() - 15. \-baz() + 13. \-rlang (local) foo() + 14. \-rlang (local) bar() + 15. \-rlang (local) baz() 16. \-base::stop("bar") Code # Wrapped handler, `try_fetch()` @@ -219,25 +219,25 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-err(ff()) + 2. +-rlang:::err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-ff() - 10. \-gg() - 11. \-hh() + 9. \-rlang (local) ff() + 10. \-rlang (local) gg() + 11. \-rlang (local) hh() 12. +-rlang::try_fetch(foo(), error = function(cnd) handler1(cnd)) 13. | +-base::tryCatch(...) 14. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers) 15. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler) 17. | \-base::withCallingHandlers(...) - 18. \-foo() - 19. \-bar() - 20. \-baz() + 18. \-rlang (local) foo() + 19. \-rlang (local) bar() + 20. \-rlang (local) baz() 21. \-base::stop("bar") Code # Wrapped handler, incorrect `call` @@ -253,19 +253,19 @@ Backtrace: x 1. +-base::print(err(ff())) - 2. +-err(ff()) + 2. +-rlang:::err(ff()) 3. | \-testthat::expect_error(...) 4. | \-testthat:::expect_condition_matching(...) 5. | \-testthat:::quasi_capture(...) 6. | +-testthat (local) .capture(...) 7. | | \-base::withCallingHandlers(...) 8. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) - 9. \-ff() - 10. \-gg() - 11. \-hh() + 9. \-rlang (local) ff() + 10. \-rlang (local) gg() + 11. \-rlang (local) hh() 12. +-base::withCallingHandlers(foo(), error = handler1) - 13. \-foo() - 14. \-bar() - 15. \-baz() + 13. \-rlang (local) foo() + 14. \-rlang (local) bar() + 15. \-rlang (local) baz() 16. \-base::stop("bar") From fbd3a91d268eb3cfd549420e88e42ff9bb9901b9 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Thu, 15 Aug 2024 17:49:28 -0700 Subject: [PATCH 6/7] Tweak implementation --- R/standalone-types-check.R | 17 ++++++++--------- tests/testthat/_snaps/arg.md | 4 ++-- .../testthat/_snaps/standalone-types-check.md | 18 ++++++------------ tests/testthat/test-standalone-types-check.R | 6 +++--- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/R/standalone-types-check.R b/R/standalone-types-check.R index d4cdc314e..6bf1ebf93 100644 --- a/R/standalone-types-check.R +++ b/R/standalone-types-check.R @@ -459,20 +459,21 @@ check_formula <- function(x, check_character <- function(x, ..., - allow_na = FALSE, + allow_na = TRUE, allow_null = FALSE, arg = caller_arg(x), call = caller_env()) { if (!missing(x)) { - if (is_character(x) & allow_na) { - return(invisible(NULL)) - } - - if (is_character(x)){ + if (is_character(x)) { if (!allow_na && any(is.na(x))) { - cli::cli_abort("`x` must not contain NA values.", call = caller_env()) + abort( + sprintf("`%s` can't contain NA values.", arg), + arg = arg, + call = call + ) } + return(invisible(NULL)) } @@ -481,12 +482,10 @@ check_character <- function(x, } } - stop_input_type( x, "a character vector", ..., - allow_na = allow_na, allow_null = allow_null, arg = arg, call = call diff --git a/tests/testthat/_snaps/arg.md b/tests/testthat/_snaps/arg.md index 390010801..a27951d92 100644 --- a/tests/testthat/_snaps/arg.md +++ b/tests/testthat/_snaps/arg.md @@ -262,8 +262,8 @@ (expect_error(f(na_chr))) Output - Error in `arg_match()`: - ! `x` must not contain NA values. + Error in `f()`: + ! `x` must be a single string, not a character `NA`. Code (expect_error(f(chr()))) Output diff --git a/tests/testthat/_snaps/standalone-types-check.md b/tests/testthat/_snaps/standalone-types-check.md index 1e6b606e9..a54db03a6 100644 --- a/tests/testthat/_snaps/standalone-types-check.md +++ b/tests/testthat/_snaps/standalone-types-check.md @@ -438,18 +438,6 @@ Error in `checker()`: ! `foo` must be a character vector, not `NA`. - Code - err(checker(na_chr, check_character)) - Output - - Error in `checker()`: - ! `x` must not contain NA values. - Code - err(checker(c("a", NA), check_character)) - Output - - Error in `checker()`: - ! `x` must not contain NA values. Code err(checker(1, check_character)) Output @@ -462,6 +450,12 @@ Error in `checker()`: ! `foo` must be a character vector or `NULL`, not a list. + Code + err(checker(c("a", NA), check_character, allow_na = FALSE)) + Output + + Error in `checker()`: + ! `foo` can't contain NA values. # `check_logical()` checks diff --git a/tests/testthat/test-standalone-types-check.R b/tests/testthat/test-standalone-types-check.R index 745c08c48..a8a6e177c 100644 --- a/tests/testthat/test-standalone-types-check.R +++ b/tests/testthat/test-standalone-types-check.R @@ -152,20 +152,20 @@ test_that("`check_environment()` checks", { test_that("`check_character()` checks", { expect_null(check_character("")) + expect_null(check_character(na_chr)) + expect_null(check_character(c("a", NA))) expect_null(check_character(chr())) expect_null(check_character("foo")) expect_null(check_character(letters)) expect_null(check_character(NULL, allow_null = TRUE)) - expect_null(check_character(c("a",NA), allow_na = TRUE)) expect_snapshot({ err(checker(, check_character)) err(checker(NULL, check_character)) err(checker(NA, check_character)) - err(checker(na_chr, check_character)) - err(checker(c("a", NA), check_character)) err(checker(1, check_character)) err(checker(list("foo", "bar"), check_character, allow_null = TRUE)) + err(checker(c("a", NA), check_character, allow_na = FALSE)) }) }) From 3e674b8087f41d2e5374b07cbd63cee858169e04 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Thu, 15 Aug 2024 18:01:26 -0700 Subject: [PATCH 7/7] Mention in changelog --- R/standalone-types-check.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/standalone-types-check.R b/R/standalone-types-check.R index 6bf1ebf93..22ea57ba8 100644 --- a/R/standalone-types-check.R +++ b/R/standalone-types-check.R @@ -9,6 +9,9 @@ # # ## Changelog # +# 2024-08-15: +# - `check_character()` gains an `allow_na` argument (@martaalcalde, #1724) +# # 2023-03-13: # - Improved error messages of number checkers (@teunbrand) # - Added `allow_infinite` argument to `check_number_whole()` (@mgirlich). @@ -457,6 +460,8 @@ check_formula <- function(x, # Vectors ----------------------------------------------------------------- +# TODO: Figure out what to do with logical `NA` and `allow_na = TRUE` + check_character <- function(x, ..., allow_na = TRUE,