Closed m-muecke closed 7 months ago
:+1:
👍
whats your preference?
we can/should move to exception handling with rlang functions, seems standard for tidyverse packages. thank you for pointing that out!
on 2nd thought:
we use checkmate everywhere and checkmate does not use rlang exceptions anyway, so let's stick with stop(call. = FALSE)
and warning(call. = FALSE)
on 2nd thought: we use checkmate everywhere and checkmate does not use rlang exceptions anyway, so let's stick with
stop(call. = FALSE)
andwarning(call. = FALSE)
Sounds good. With rlang::abort
you would've to add the environment for all errors in the helper functions anyways, leading to quite a bit of modification otherwise you would still have the entire stack or I guess just setting the call to NULL would've done the same. This would've been the pattern in non exported functions:
foo <- function(..., error_call = caller_env()) {
abort("error", call = error_call)
}
Currently
rlang
is already used in the package, thus I would vote for either usingrlang::abort
, etc. instead of stop and warning for nicer errors or not displaying the call withstop(call. = FALSE)
andwarning(call. = FALSE)
https://design.tidyverse.org/err-call.html.Example for using it with stop in the lintr package: https://github.com/r-lib/lintr/blob/main/R/comments.R#L87