try_error: Try an expression and see if it throws an error

View source: R/utils.R

try_errorR Documentation

Try an expression and see if it throws an error

Description

Use tryCatch() to check if an expression throws an error.

Usage

try_error(expr)

Arguments

expr

An R expression.

Value

TRUE (error) or FALSE (success).

Examples

xfun::try_error(stop("foo"))  # TRUE
xfun::try_error(1:10)  # FALSE

xfun documentation built on Nov. 17, 2022, 1:06 a.m.