attempt icon indicating copy to clipboard operation
attempt copied to clipboard

stop_if_none : behavior different than expected

Open apetit5108 opened this issue 3 years ago • 1 comments

stop_if_none doesn't behave like I expected. Shouldn't it be equivalent to stop_if_not(any()) ? I am a french speaker but that is how I understand the term "none" = "not any"

attempt::stop_if_none(c(T, T), msg = "Error") # No error, fine for me
attempt::stop_if_none(c(F, F), msg = "Error") # Error, fine for me
attempt::stop_if_none(c(T, F), msg = "Error") # Error, while I was expecting No error

attempt::stop_if_not(any(c(T, T)), msg = "Error") # No error
attempt::stop_if_not(any(c(F, F)), msg = "Error") # Error
attempt::stop_if_not(any(c(T, F)), msg = "Error") # No error

apetit5108 avatar Jun 24 '22 08:06 apetit5108

Thanks for reporting.

This is indeed a bug, attempt::stop_if_none(c(T, F), msg = "Error") should indeed throw no error.

Will fix this soon

ColinFay avatar Aug 23 '24 11:08 ColinFay