From b06f95d8494f601ee72ee6388716fa0d6e0a27e3 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Mon, 22 Jul 2024 15:51:32 +0100 Subject: [PATCH 1/4] update `clustering_cv()` to cli --- R/clustering.R | 2 +- tests/testthat/_snaps/clustering.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/clustering.R b/R/clustering.R index 934e936a..5ed07f60 100644 --- a/R/clustering.R +++ b/R/clustering.R @@ -65,7 +65,7 @@ clustering_cv <- function(data, vars <- tidyselect::eval_select(rlang::enquo(vars), data = data) if (rlang::is_empty(vars)) { - rlang::abort("`vars` are required and must be variables in `data`.") + cli_abort("{.arg vars} is required and must contain at least one variable in {.arg data}.") } vars <- data[vars] diff --git a/tests/testthat/_snaps/clustering.md b/tests/testthat/_snaps/clustering.md index 87003aaf..956070ab 100644 --- a/tests/testthat/_snaps/clustering.md +++ b/tests/testthat/_snaps/clustering.md @@ -1,6 +1,6 @@ # bad args - `vars` are required and must be variables in `data`. + `vars` is required and must contain at least one variable in `data`. --- From a3671275f25e60cdfbfcc09165aaad2bf1b46640 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Mon, 22 Jul 2024 15:52:08 +0100 Subject: [PATCH 2/4] update helper for `complement()` to cli --- R/complement.R | 3 ++- tests/testthat/_snaps/rsplit.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/complement.R b/R/complement.R index a3f1cf31..12509627 100644 --- a/R/complement.R +++ b/R/complement.R @@ -66,7 +66,8 @@ get_stored_out_id <- function(x) { } if (all(is.na(out_id))) { - rlang::abort("Cannot derive the assessment set for this type of resampling.") + x_cls <- class(x) + cli_abort("Cannot derive the assessment set for this type of resampling with class{?es}: {.cls {x_cls}}.") } out_id diff --git a/tests/testthat/_snaps/rsplit.md b/tests/testthat/_snaps/rsplit.md index 5b785db6..c5db834d 100644 --- a/tests/testthat/_snaps/rsplit.md +++ b/tests/testthat/_snaps/rsplit.md @@ -50,5 +50,5 @@ get_stored_out_id(list(out_id = NA)) Condition Error in `get_stored_out_id()`: - ! Cannot derive the assessment set for this type of resampling. + ! Cannot derive the assessment set for this type of resampling with class: . From 89d70449f2df76879a2f91e2454c6d3f7de27a20 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Mon, 22 Jul 2024 15:53:54 +0100 Subject: [PATCH 3/4] add NEWS bullet --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 2bfa516a..76396fc8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * The new `inner_split()` function and its methods for various resamples is for usage in tune to create a inner resample of the analysis set to fit the preprocessor and model on one part and the post-processor on the other part (#483, #488, #489). +* Started moving error messages to cli (#499). + ## Bug fixes * `vfold_cv()` now utilizes the `breaks` argument correctly for repeated cross-validation (@ZWael, #471). From cfe719b2d922ae2c0bf8f4415edf56678d3b36b9 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Mon, 22 Jul 2024 16:36:42 +0100 Subject: [PATCH 4/4] add this PR to NEWS --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 76396fc8..2e678b33 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ * The new `inner_split()` function and its methods for various resamples is for usage in tune to create a inner resample of the analysis set to fit the preprocessor and model on one part and the post-processor on the other part (#483, #488, #489). -* Started moving error messages to cli (#499). +* Started moving error messages to cli (#499, #502). ## Bug fixes