jonthegeek / stbl

Stabilize Function Arguments
https://jonthegeek.github.io/stbl/
Other
14 stars 0 forks source link

regex error is useless #52

Open jonthegeek opened 1 year ago

jonthegeek commented 1 year ago
# Try to check a url.
stbl::stabilize_chr_scalar(
  "not a url",
  regex = "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
)
#> Error:
#> ! `"not a url"` must match the provided regex pattern.
#> ✖ Some values do not match.
#> • Locations: 1

Created on 2023-08-25 with reprex v2.0.2

At a minimum we should show the regex pattern. Somewhere in the hierarchy we should allow the user to provide a better definition of the object they're asking us to validate, probably (cuz "must be a url" would be way clearer).