Skip to content

Commit

Permalink
use cli errors and warnings (closes #241)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Aug 28, 2024
1 parent aef8cd4 commit 23258f2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# workflows (development version)

* Package warnings and errors have been transitioned to use cli instead of rlang
(#241).

* `add_variables()` reference added to `stages` vignette (@brshallo, #190).
* New `extract_fit_time()` method has been added that return the time it took to train the workflow. (#191)

* New `extract_fit_time()` method has been added that return the time it took to train the workflow (#191).

# workflows 1.1.4

Expand Down
2 changes: 1 addition & 1 deletion R/fit-action-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ remove_model <- function(x) {
validate_is_workflow(x)

if (!has_spec(x)) {
rlang::warn("The workflow has no model to remove.")
cli::cli_warn("The workflow has no model to remove.")
}

new_workflow(
Expand Down
2 changes: 1 addition & 1 deletion R/post-action-tailor.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ remove_tailor <- function(x) {
validate_is_workflow(x)

if (!has_postprocessor(x)) {
rlang::warn("The workflow has no tailor postprocessor to remove.")
cli::cli_warn("The workflow has no tailor postprocessor to remove.")
}

actions <- x$post$actions
Expand Down
2 changes: 1 addition & 1 deletion R/pre-action-formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ remove_formula <- function(x) {
validate_is_workflow(x)

if (!has_preprocessor_formula(x)) {
rlang::warn("The workflow has no formula preprocessor to remove.")
cli::cli_warn("The workflow has no formula preprocessor to remove.")
}

actions <- x$pre$actions
Expand Down
2 changes: 1 addition & 1 deletion R/pre-action-recipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ remove_recipe <- function(x) {
validate_is_workflow(x)

if (!has_preprocessor_recipe(x)) {
rlang::warn("The workflow has no recipe preprocessor to remove.")
cli::cli_warn("The workflow has no recipe preprocessor to remove.")
}

actions <- x$pre$actions
Expand Down
2 changes: 1 addition & 1 deletion R/pre-action-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ remove_variables <- function(x) {
validate_is_workflow(x)

if (!has_preprocessor_variables(x)) {
rlang::warn("The workflow has no variables preprocessor to remove.")
cli::cli_warn("The workflow has no variables preprocessor to remove.")
}

actions <- x$pre$actions
Expand Down
2 changes: 1 addition & 1 deletion R/survival-censoring-weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
cens_predictors = NULL,
trunc = 0.05, eps = 10^-10, ...) {
if (is.null(object$fit$fit)) {
rlang::abort("The workflow does not have a model fit object.")
cli::cli_abort("The workflow does not have a model fit object.")
}
.censoring_weights_graf(object$fit$fit, predictions, cens_predictors, trunc, eps)
}

0 comments on commit 23258f2

Please sign in to comment.