Repository navigation
Move error signalling to rlang::abort() - #3526
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 |
clauswilke
left a comment
There was a problem hiding this comment.
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 |
|
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)