Conditions for cnd
{cnd}
These conditions are made with the {cnd} package though the use of
condition().
{cnd} conditions
cnd:as_character_cnd_error/error
- package
{cnd}- class
cnd:as_character_cnd_error- type
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:
cnd:cnd_document_conditions/warning
- package
{cnd}- class
cnd:cnd_document_conditions- type
warning
Documentation will fail when no conditions are found. You may be executing cnd_document() too early, before conditions have been registered. You can try to find your conditions with conditions().
cnd:cnd_document_file/error
- package
{cnd}- class
cnd:cnd_document_file- type
error
The file argument to cnd_document() must be a file path, a connection object, or NULL to return the documentation as a character vector. The default value should be suitable for standard use cases.
cnd:cnd_document_pkg_reg/error
- package
{cnd}- class
cnd:cnd_document_pkg_reg- type
error
Both package and registry must be set to document conditions.You can set a registry by adding cnd_create_registry() calls to your package code.
cnd:cnd_generated_cleanup/message
- package
{cnd}- class
cnd:cnd_generated_cleanup- type
message
Some files created during the documentation process may become obsolete while updating your conditions.
cnd:cnd_generated_write/condition
- package
{cnd}- class
cnd:cnd_generated_write- type
condition
This condition is signaled when cnd_document() needs to write new documentation files.
cnd:cond_cnd_class/error
- package
{cnd}- class
cnd:cond_cnd_class- type
error
cnd() simple calls the appropriate function: stop(), warning(), or message() based on the type parameter from condition().
cnd:condition_message_generator/error
- package
{cnd}- class
cnd:condition_message_generator- type
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
- package
{cnd}- class
cnd:condition_overwrite- type
warning
Defining a new condition with the same class and package as an existing condition will overwrite the previous definition. It is recommended to either avoid this by fully defining your condition, or creating a new condition instead.
cnd:conditions_dots/warning
- package
{cnd}- class
cnd:conditions_dots- type
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
- package
{cnd}- class
cnd:invalid_condition- type
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
- package
{cnd}- class
cnd:invalid_condition_message- type
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
- package
{cnd}- class
cnd:match_arg- type
error
Mostly match.arg() but with a custom condition