cli
cli copied to clipboard
Use `.internal` argument with `cli::cli_abort()`
I am developing a package. I am switching my error calls from rlang::abort()
to cli::cli_abort()
abort("Problem", .internal = TRUE)
This is an internal error in the canadr package, please report it to the package authors.
cli::cli_abort("Problem", .internal = TRUE)
This is an internal error in the cli package, please report it to the
package authors.
But in the cli documentation, it is written that the ... are passed from cli::abort()
to rlang::abort()
I don't know how to provide a reprex.
@lionel- Is there a workaround here? Setting .frame
does not seem to help.
Do you have latest rlang?
foo <- function() {
cli::cli_abort("foo", .internal = TRUE)
}
environment(foo) <- rlang::ns_env("purrr")
foo()
#> Error in `foo()`:
#> ! foo
#> ℹ This is an internal error in the purrr package, please report it to the
#> package authors.
@lionel- I've also experienced this issue with the latest rlang.
Update: I found I could fix it by setting .frame = current_env()
. Perhaps {cli} could set .frame = caller_env()
when the user has set .internal = TRUE
?
@davidchall You also need dev cli for a full fix, see #479.
So as I understand this is fixed now, and there is nothing to do in cli?