is.err: Check if Result is an Err

Description Usage Arguments Value Examples

View source: R/check.R

Description

Test whether Result Enum is Ok or an Err.

Usage

1
is.err(x)

Arguments

x

object to be tested

Value

TRUE if x is enumerated type of variant Err, FALSE otherwise

Examples

1
2
3
4
5
6
sqrt_big <- function(x) {
  if (x > 1000){ return(Ok(sqrt(x))) }
  Err("Not large enough!")
}
x <- sqrt_big(250)
is.err(x)  # TRUE

matchr documentation built on Sept. 9, 2021, 5:07 p.m.

Related to is.err in matchr...