This is a small wrapper around tryCatch()
that captures any
condition signalled while evaluating its argument. It is useful for
situations where you expect a specific condition to be signalled,
for debugging, and for unit testing.
catch_cnd(expr, classes = "condition")
A condition if any was signalled, NULL
otherwise.
Expression to be evaluated with a catching condition handler.
A character vector of condition classes to catch. By default, catches all conditions.
catch_cnd(10)
catch_cnd(abort("an error"))
catch_cnd(signal("my_condition", message = "a condition"))
Run the code above in your browser using DataLab