-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
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.
Done up to coord-.R
. This seems like an ok place to stop for now so you can handle the feedback so far.
(Also needs redocumenting to fix the build errors) |
Co-authored-by: Hadley Wickham <[email protected]>
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.
Done to the end of R/grob-dotstack.r
Co-authored-by: Hadley Wickham <[email protected]>
@hadley all errors except for a few special concessions have now been covered with 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!
@@ -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}") |
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.
The plan is to work through all the call
arguments in the next PR?
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.
yes - the places where it is needed
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