Skip to content

Update errors, warnings, and messages to cli #4796

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 28 commits into from
May 18, 2022
Merged

Update errors, warnings, and messages to cli #4796

merged 28 commits into from
May 18, 2022

Conversation

thomasp85
Copy link
Member

This PR updates all user messaging to use the cli framework for proper formating. This PR is almost a direct translation from the old behaviour, but it does include a few refactors to make the code simpler where possible, using e.g. the auto collapsing feature of cli.

The changes has led to a few failing tests. These tests have been updated to use the new expect_snapshot_*() functions to better handle messages with formating.

This PR will be followed an additional PR looking into better error message chaining to let users know where errors occurred during rendering

@thomasp85 thomasp85 requested a review from hadley April 7, 2022 12:37
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

Done up to coord-.R. This seems like an ok place to stop for now so you can handle the feedback so far.

@hadley
Copy link
Member

hadley commented Apr 10, 2022

(Also needs redocumenting to fix the build errors)

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

Done to the end of R/grob-dotstack.r

@thomasp85
Copy link
Member Author

@hadley all errors except for a few special concessions have now been covered with tests

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -199,7 +197,7 @@ Layer <- ggproto("Layer", NULL,
} else if (is.function(self$data)) {
data <- self$data(plot_data)
if (!is.data.frame(data)) {
abort("Data function must return a data.frame")
cli::cli_abort("{.fn layer_data} must return a {.cls data.frame}")
Copy link
Member

Choose a reason for hiding this comment

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

The plan is to work through all the call arguments in the next PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes - the places where it is needed

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