-
Notifications
You must be signed in to change notification settings - Fork 2
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
improving check_pop_data()
#207
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! How do we communicate the error classes available in the package?
} | ||
|
||
missing_age <- is.element(attributes(pop_data)$age_var, names(pop_data)) | ||
|
||
if (!missing_age) { | ||
cli::cli_abort(message = paste("Argument `pop_data` is missing column", attributes(pop_data)$age_var, "(age, in years)")) | ||
"Argument {.arg pop_data} is missing column {.var {attributes(pop_data)$age_var}} (age, in years)" %>% | ||
cli::cli_abort(class = "missing-var") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an exhaustive list of error classes?
"Provide a `data.frame()` with cross-sectional serology data per antigen isotype." | ||
)) | ||
cli::cli_abort( | ||
class = "not a data.frame", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we communicate all types of error classes in the package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisorwa see my other comment; I don't think so, since they aren't typically visible to users of our package.
@chrisorwa good question; I'm still coming up to speed on error classes, but as far as I can tell, they are not part of the API - we create them ourselves for our own internal use in unit tests, instead of using the |
improving error messages, added test