I’m very much appreciating recipes pointing out which step errors occurred in following #1069. We unfortunately don’t get the benefits of those changes in tune (and possibly other packages that need to catch and rethrow errors from recipes, see tidymodels/tune#599), as dispatch falls back to the rlang_error method for conditionMessage():
library(recipes)
data("ames", package = "modeldata")
err <- try(
recipe(~., data = ames) |>
step_novel(Neighborhood, new_level = "Gilbert") |>
prep()
)
#> Error in step_novel() :
#> Caused by error in `prep()`:
#> ! Columns already contain the new level: Neighborhood
err_cnd <- attr(err, "condition")
class(err_cnd)
#> [1] "recipes_error_step" "recipes_error" "rlang_error"
#> [4] "error" "condition"
conditionMessage(err_cnd)
#> [1] "\nCaused by error in `prep()`:\n! Columns already contain the new level: Neighborhood"
Could we add a conditionMessage method that precedes the current conditionMessage() output with “Error in step_*”?
Created on 2023-01-20 with reprex v2.0.2
I’m very much appreciating recipes pointing out which step errors occurred in following #1069. We unfortunately don’t get the benefits of those changes in tune (and possibly other packages that need to catch and rethrow errors from recipes, see tidymodels/tune#599), as dispatch falls back to the
rlang_errormethod forconditionMessage():Could we add a
conditionMessagemethod that precedes the currentconditionMessage()output with “Error instep_*”?Created on 2023-01-20 with reprex v2.0.2