Skip to content

Improve error message for tab_options() wrong input #1730

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

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

olivroy
Copy link
Collaborator

@olivroy olivroy commented Jun 25, 2024

Summary

While working on something else, I noticed that the error message for wrong type for options was not informative.

check_*() won't allow NA by default, although it is possible to override this!

Using arg = var_name allows to include the faulty argument's name. (although it will loose its . for _ due to tidy_gsub(), but will still be informative!

# Before
exibble |> gt() |> tab_options(footnotes.multiline = "\n")
#> Error in `dplyr::mutate()`:In argument: `value = mapply(...)`.
Caused by error:
! rlang::is_scalar_logical(option) is not TRUE

# This PR
#> Error in `tab_options()`:
#> ! `footnotes_multiline` must be `TRUE` or `FALSE`, not the string "\n".

Checklist

@olivroy olivroy force-pushed the options-validate branch from ff6cfe3 to 3631c30 Compare June 25, 2024 13:32
Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

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

Thanks!

@rich-iannone
Copy link
Member

@olivroy feel free to merge this at your convenience.

@olivroy
Copy link
Collaborator Author

olivroy commented Jun 25, 2024

@rich-iannone I don't have the rights to do this

@rich-iannone
Copy link
Member

Sorry for the delay (and the misunderstanding above). Will merge now.

@rich-iannone rich-iannone merged commit 8592bd4 into rstudio:master Jun 26, 2024
12 checks passed
@olivroy olivroy deleted the options-validate branch June 26, 2024 11:48
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.

2 participants