Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework error messages #14

Merged
merged 13 commits into from
Oct 19, 2024
Merged

rework error messages #14

merged 13 commits into from
Oct 19, 2024

Conversation

topepo
Copy link
Member

@topepo topepo commented Oct 18, 2024

Updates to testing with:

  • cli functions
  • expect_snapshot_error() converted to expect_snapshot(..., error = TRUE)
  • call routing
  • type checkers

R/checks.R Outdated
is_d_input <- function(x) {
tmp <- purrr::map(x, check_numeric, input = "desirability")
tmp <- purrr::map(x, check_unit_range)
is_d_input <- function(x, call) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next PR will use a constructor to check these things and give the desirability vectors classes c("numeric", "desirability") without going full vctrs.

That will make these checks a lot easier/better. The current method would let something like roc_auc in without an error.

@EmilHvitfeldt EmilHvitfeldt self-requested a review October 18, 2024 20:14
Copy link
Member

@EmilHvitfeldt EmilHvitfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first round of comments! once they are resolved we can go back and see if there are more

R/checks.R Outdated Show resolved Hide resolved
R/checks.R Outdated Show resolved Hide resolved
R/checks.R Outdated Show resolved Hide resolved
R/checks.R Show resolved Hide resolved
R/checks.R Outdated Show resolved Hide resolved
R/computations.R Outdated Show resolved Hide resolved
R/checks.R Outdated Show resolved Hide resolved
R/computations.R Outdated Show resolved Hide resolved
R/computations.R Outdated Show resolved Hide resolved
R/in-line.R Outdated Show resolved Hide resolved
@topepo topepo merged commit c57e0ad into main Oct 19, 2024
13 checks passed
@topepo topepo deleted the error-updates branch October 19, 2024 21:03
Copy link

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just flagging one missed substitution.

if (!is.vector(x) || !is.numeric(x)) {
rlang::abort(paste0(input, " should be a numeric vector."))
cli::cli_abort("{.arg {input}} should be {an} numeric vector.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This substitution will raise an error, as there's no an in the fn environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants