catch_cnd

0th

Percentile

Catch a condition

This is a small wrapper around tryCatch() that captures any condition signalled while evaluating its argument. It is useful for debugging and unit testing.

Usage
catch_cnd(expr)
Arguments
expr

Expression to be evaluated with a catch-all condition handler.

Value

A condition if any was signalled, NULL otherwise.

Aliases
  • catch_cnd
Examples
library(rlang) # NOT RUN { catch_cnd(10) catch_cnd(abort("an error")) catch_cnd(cnd_signal("my_condition", .msg = "a condition")) # }
Documentation reproduced from package rlang, version 0.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.