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

try_error {xfun} | R 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

[Package xfun version 0.31 Index]