-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
When a missing value (NaN) is given to the 'length' argument of assert_length we give a very obscure error message:
library(assertions)
#> Warning: package 'assertions' was built under R version 4.4.1
assert_length(1:3, length = NaN)
#> Error in if (!is_whole_number(length)) return("'length' must be a whole number"): missing value where TRUE/FALSE neededCreated on 2026-02-11 with reprex v2.1.1
There are lots of functions that have this issue. assert_greater_than fails when minimum is NaN with bad error message.
Part of this is that helpers like is_whole_number returns missing values when values are missing when they should return False. We should also check these sorts of arguments earlier and explicitly provide informative errors when they are missing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels