Skip to content

Improve error message for gt functions #1504

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 3 commits into from
Dec 5, 2023

Conversation

olivroy
Copy link
Collaborator

@olivroy olivroy commented Dec 4, 2023

Summary

Use rlang::caller_env() to help user find the source of the error more easily.

# before 
mtcars |> fmt_number()
Error in `stop_if_not_gt_tbl()`:
! The `data` provided is not a `gt_tbl` object.

# With this PR
mtcars |> fmt_number()
Error in `fmt_number()`:
! `data` must be a `gt_tbl` object, not a data frame.

Checklist

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.

This is excellent. Thank you!

@rich-iannone rich-iannone merged commit 2246c71 into rstudio:master Dec 5, 2023
@olivroy olivroy deleted the error-msg branch December 5, 2023 11:51
@olivroy olivroy mentioned this pull request Apr 18, 2024
@olivroy olivroy mentioned this pull request May 23, 2024
3 tasks
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