cnd
Conditions for cnd
These conditions are made with the {cnd}
package though the use of
condition()
.
cnd:as_character_cnd_error/error
{cnd}
cnd:as_character_cnd_error
error
You cannot coerce a condition_generator object to a character. This may have occurred when trying to put a condition function through stop()
or warning. Instead, call the function first, then pass the result to stop()
or warning()
.
For example:
# Instead of this
stop(my_condition)# Do this
stop(my_condition())
cnd:cnd_document_conditions/warning
{cnd}
cnd:cnd_document_conditions
warning
no help documentation provided
cnd:cnd_document_file/error
{cnd}
cnd:cnd_document_file
error
no help documentation provided
cnd:cnd_document_pkg_reg/error
{cnd}
cnd:cnd_document_pkg_reg
error
no help documentation provided
cnd:cnd_generated_cleanup/message
{cnd}
cnd:cnd_generated_cleanup
message
no help documentation provided
cnd:cnd_generated_write/condition
{cnd}
cnd:cnd_generated_write
condition
no help documentation provided
cnd:cond_cnd_class/error
{cnd}
cnd:cond_cnd_class
error
cnd()
simple calls the appropriate function: stop()
, warning()
, or message()
based on the type
parameter from condition()
.
cnd:condition_message_generator/error
{cnd}
cnd:condition_message_generator
error
condition_generator objects are not conditions. You may have made this mistake:
x <- condition("my_condition")
conditionMessage(x)
Condition generators need to be called first before they can be used as conditions. Try this instead:
x <- condition("my_condition")
conditionMessage(x())
cnd:condition_overwrite/warning
{cnd}
cnd:condition_overwrite
warning
no help documentation provided
cnd:conditions_dots/warning
{cnd}
cnd:conditions_dots
warning
The ...
parameter in conditions()
is meant for convenience. Only a single argument is allowed. Other parameters must be named explicitly.
For example:
# Instead of this
conditions("class", "package") # "package" is ignored with a warning# Do this
conditions(class = "class", package = "package")
cnd:invalid_condition/error
{cnd}
cnd:invalid_condition
error
The class
, exports
, and help
parameters must be a single character string. If you are passing a function, it must be a valid function.
cnd:invalid_condition_message/error
{cnd}
cnd:invalid_condition_message
error
Conditions messages are displayed when invoked through conditionMessage()
. You can set a static message by passing through a character
vector, or a dynamic message by passing through a function
. The function should return a character
vector.
When message
is not set, a default "there was an error" message is used.
cnd:match_arg/error
{cnd}
cnd:match_arg
error
Mostly match.arg()
but with a custom condition
cnd:no_package_exports/warning
{cnd}
cnd:no_package_exports
warning
The exports
parameter requires a package
The following conditions are defined in the {cnd}
package.
cnd-package condition