scales
scales copied to clipboard
Propagate call for error messages
trafficstars
This PR aims to fix #379.
Briefly, it adds a call argument to range training that is used to communicate error messages.
Short demo:
devtools::load_all("~/packages/scales")
#> ℹ Loading scales
i_train_ranges <- function(x) {
range <- ContinuousRange$new()
range$train(x, call = current_call())
range$range
}
i_train_ranges(1:10)
#> [1] 1 10
i_train_ranges(c("foo", "bar"))
#> Error in `i_train_ranges()`:
#> ! Discrete value supplied to a continuous scale
Created on 2023-12-22 with reprex v2.0.2