Validation - Throw error from custom predicate
assert_predicate.RdThis function evaluates a custom predicate function on an object and aborts with a custom message if the check fails. It is useful for testing function arguments.
Arguments
- fun
[
\(){}] The predicate function to run. Must receive the object to test as its first argument.- ...
[
anyeach] Objects to check.- args_fun
[
list()] Additional arguments to pass tofun.- msg
[
character(1)|NULL] The message to use if the check fails. IfNULL, a default message is generated.- x_names
[
character()|NULL] The names of...to print in messages. IfNULL, the name is inferred from...'s expressions.- env
[
environment()|call()|NULL|missing_arg()] The call to inform as the origin of the error, passed torlang::abort():An environment in the call stack or a hard-coded defused call.
NULLfor no information.missing_arg()to use the assert function itself.The default is
caller_env(), to display the function where the assertion was called.
- args_cnd
[
list()] Additional arguments passed tocli::cli_abort().