Skip to contents

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

Usage

is.error(x)

Arguments

x

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

Value

[logical(1)].

Examples

x = try(stop("foo"))
#> Error in try(stop("foo")) : foo
print(is.error(x))
#> [1] TRUE
x = 1
print(is.error(x))
#> [1] FALSE