BBmisc (version 1.13)

is.error: Is return value of try an exception?

Description

Checks if an object is of class “try-error” or “error”.

Usage

is.error(x)

Value

[logical(1)].

Arguments

x

[any]
Any object, usually the return value of try, tryCatch, or a function which may return a simpleError.

Examples

Run this code
x = try(stop("foo"))
print(is.error(x))
x = 1
print(is.error(x))

Run the code above in your browser using DataLab