Learn R Programming

rlang (version 0.2.1)

catch_cnd: Catch a condition

Description

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.

Examples

Run this code
# NOT RUN {
catch_cnd(10)
catch_cnd(abort("an error"))
catch_cnd(cnd_signal("my_condition", .msg = "a condition"))
# }

Run the code above in your browser using DataLab