Skip to content

Commit

Permalink
pass call through validate_not_trained
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Oct 25, 2024
1 parent 72166c4 commit cfa2031
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/update.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ validate_has_unique_names <- function(x) {
invisible(x)
}

validate_not_trained <- function(x) {
validate_not_trained <- function(x, call = rlang::caller_env()) {
if (is_trained(x)) {
step_type <- class(x)[1]

cli::cli_abort(
"To update {.fn {step_type}}, it must not be trained."
"To update {.fn {step_type}}, it must not be trained.",
call = call
)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
Code
update(stp, x = 5)
Condition
Error in `validate_not_trained()`:
Error in `update()`:
! To update `step_stp()`, it must not be trained.

0 comments on commit cfa2031

Please sign in to comment.