Create a custom error condition created with rlang::abort() with a - hopefully - more useful error message and metadata.

abort_argument_type(arg, must, not)

abort_argument_class(arg, must, not)

abort_argument_length(arg, must, not)

abort_argument_diff_length(arg1, arg2)

abort_argument_value(arg, valid_values)

Arguments

arg

A character string with the argument name.

must

A character string specifying a condition the argument must fulfill.

not

Either a character string specifying a condition the argument must not fulfill or the bare (unquoted) argument name. In the last case, the function evaluates the argument type (abort_argument_type()) or length (abort_argument_length()) and displays the result in the error message.

arg1, arg2

A character string with the argument name.

valid_values

A character vector with the valid values.

Value

Each function returns a classed error condition. abort_argument_type() returns a error_argument_type class, abort_argument_length() returns a error_argument_length class, abort_argument_diff_length() returns a error_argument_diff_length class and abort_argument_value() returns a error_argument_value class.

See also