e_is_error: check a function and if there's an error return an indication...

View source: R/e_is_error.R

e_is_errorR Documentation

check a function and if there's an error return an indication that we can ifelse() to either run for real or skip

Description

check a function and if there's an error return an indication that we can ifelse() to either run for real or skip

Usage

e_is_error(f)

Arguments

f

report result of a try()

Value

TRUE/FALSE for error

Examples

sw_try_ok <-
  !e_is_error(
    try(
      # try what you want, check for error
      log(NULL)
    )
  )
if(sw_try_ok) {
  # no error, do what you intended to do
} else {
  # error, do something else
}

erikerhardt/erikmisc documentation built on April 17, 2025, 10:48 a.m.