Skip to content

for slide.R and changing all the rlang::abort to cli_abort - #526

Merged
hfrick merged 4 commits into
tidymodels:mainfrom
PriKalra:cli-errors-rsample-slide
Sep 9, 2024
Merged

for slide.R and changing all the rlang::abort to cli_abort#526
hfrick merged 4 commits into
tidymodels:mainfrom
PriKalra:cli-errors-rsample-slide

Conversation

@PriKalra

Copy link
Copy Markdown
Contributor

changed all rlang::abort to cli_abort. There were lot of paste0 rlang abort, they have been changed to proper syntax for cli_abort.
fixes #513

… abort, they have been changed to proper syntax for cli_abort.
@hfrick

hfrick commented Aug 23, 2024

Copy link
Copy Markdown
Member

@PriKalra Thanks a bunch for this PR and the others! I'm just dropping in quickly to say that I'm OOO until the week after next but will get to this after my return.

- evaluate `arg` to keep errors informative
- what the arg actually was will come via type checkers
Comment thread R/slide.R

if (!is.data.frame(data)) {
cli_abort("{.arg data} must be a {.cls data frame}.")
cli_abort("{.arg data} must be a data frame.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The reason for this change is a fairly subtle one: "data frame" refers to data frames in general, both of the base-R data.frame flavour and of the tibble flavour. We could use {.cls data.frame} here because tibbles are also data.frames but the error might suggest tibbles are not allowed if a user doesn't know this technical detail. Therefore I'm sticking with the general "data frame" here.

data.frame(x = 10) |> class()
#> [1] "data.frame"

tibble::tibble(x = 10) |> class()
#> [1] "tbl_df"     "tbl"        "data.frame"

Created on 2024-09-09 with reprex v2.1.0

Comment thread R/slide.R Outdated
@hfrick
hfrick merged commit 19f1485 into tidymodels:main Sep 9, 2024
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use cli errors in R/slide.R

2 participants