Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cnd_signal

Signal a condition object


Description

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

  • A message is signalled if the condition inherits from "message". This is equivalent to signalling with inform() or base::message().

  • A warning is signalled if the condition inherits from "warning". This is equivalent to signalling with warn() or base::warning().

  • An error is signalled if the condition inherits from "error". This is equivalent to signalling with abort() or base::stop().

  • An interrupt is signalled if the condition inherits from "interrupt". This is equivalent to signalling with interrupt().

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))

rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.