cnd_signal {rlang}R Documentation

Signal a condition object

Description

The type of signal depends on the class of the condition:

Use cnd_type() to determine the type of a condition.

Usage

cnd_signal(cnd, ...)

Arguments

cnd

A condition object (see cnd()). If NULL, cnd_signal() returns without signalling a condition.

...

These dots are for extensions and must be empty.

See Also

abort(), warn() and inform() for creating and signalling structured R conditions. See with_handlers() for establishing condition handlers.

Examples

# The type of signal depends on the class. If the condition
# inherits from "warning", a warning is issued:
cnd <- warning_cnd("my_warning_class", message = "This is a warning")
cnd_signal(cnd)

# If it inherits from "error", an error is raised:
cnd <- error_cnd("my_error_class", message = "This is an error")
try(cnd_signal(cnd))

[Package rlang version 0.4.9 Index]