Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate call for error messages #416

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve messaging in Range R6 classes
1 participant