-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Move error signalling to rlang::abort() #3526
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
Basically looks good to me! Two minor comments.
So I think all
|
And one comment from my side: Should all the new error messages in code that replaces |
I’ll fix 1. As for 2. I discussed this with Hadley and my feeling is that it is too likely that something will slip through and the user will be getting a |
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.
I've read over all changes. I didn't notice any issues except the minor typos I indicated.
Yes. I meant, so we might need to check the code programmatically on CI. For example: library(testthat)
get_stop <- function(f) {
d <- getParseData(parse(f))
d[d$token == "SYMBOL_FUNCTION_CALL" & d$text == "stop", ]
}
test_that("do not use stop()", {
stops <- purrr::map_dfr(list.files("R", full.names = TRUE), get_stop, .id = "file")
expect_equal(nrow(stops), 0)
})
#> Error: Test failed: 'do not use stop()'
#> * nrow(stops) not equal to 0.
#> 1/1 mismatches
#> [1] 173 - 0 == 173 |
I'm putting this on ice until the next rlang release (@lionel- said it would be soon) that will include an |
Is this the version? |
yeah, but immediate printing of warning turns out to not be possible to implement with the slang conditions... don't know if it is really that necessary |
It's impossible with any condition object, not just rlang. It's possibly a bug in |
fair - didn't meant to call rlang out |
Bug report submitted at https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17646 |
Team (@hadley, @clauswilke, @yutannihilation, @karawoo, @paleolimbot). With the merge of this PR ggplot2 now exclusively uses Further, the style now is to rely on glue to compose the messages inside conditions, to the extent possible... It is not checked, so be aware of this when reviewing PRs |
This PR changes all calls to
stop()
toabort()
from rlang. It further removes the last calls tostopifnot()
in favour ofif (...) abort(...)
which should hopefully result in some better error messages (as well as consistent error tracing across all exceptions)