Skip to content

Commit

Permalink
inline enum in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Dec 11, 2024
1 parent fd0ddbf commit 9597850
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion R/validation-rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ check_duplicates <- function(x, call) {
non_mutates <- table(x$name[x$name != "predictions_custom"])
if (any(non_mutates > 1)) {
bad_adjustment <- names(non_mutates[non_mutates > 1])
cli_abort("adjustments cannot be duplicated: {.val {bad_adjustment}}", call = call)
cli_abort(
"Adjustment{?s} {.fn {bad_adjustment}} {?was/were} duplicated.",
call = call
)
}
invisible(x)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/validation-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
adjust_probability_calibration()
Condition
Error in `adjust_probability_threshold()`:
! adjustments cannot be duplicated: "probability_threshold"
! Adjustment `probability_threshold()` was duplicated.

---

Expand Down

0 comments on commit 9597850

Please sign in to comment.