handle_error: Handle runtime errors

View source: R/quit_on_failure.R

handle_errorR Documentation

Handle runtime errors

Description

Evaluates the given expression and then runs the on_success, on_error, or on_warning expressions depending on the result of the initial evaluation.

Usage

handle_error(
  expr,
  on_success = {
 },
  on_error = {
 },
  on_warning = {
 },
  finally = {
 }
)

Arguments

expr

Expression to evaluate

on_success

Expression to evaluate if expr succeeds

on_error

Expression to evaluate if expr generates an error

on_warning

Expression to evaluate if expr generates a warning

finally

Expression to evaluate after expr and on_success or on_error or on_warning, usually used for cleanup.

Value

Invisible result of expr if it succeeds, otherwise the error or warning object.


rundel/checklist documentation built on Oct. 31, 2023, 9:26 a.m.