conditionHandler: Condition-Handling Without Losing Information.

View source: R/utils.R

conditionHandlerR Documentation

Condition-Handling Without Losing Information.

Description

Function is intented to wrap expressions provided and catching all potentially useful information generated by the wrapped expression, i.e. errors, warnings, and messages.

Usage

conditionHandler(expr, file = NULL)

Arguments

expr

(expression) for which exception handling should be provided

file

(character) string specifying a file to which all captured output shall be written

Value

(list) with element "result", "status" (0 = no warnings, no errors), 1 = warnings were caught, 2 = errors were caught no result generated, "warnings", "errors", "messages"

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Examples

conditionHandler(warning("This is a warning!"))
f <- function(expr){warning("This a warning!"); eval(expr)}
conditionHandler(f(1/2))
conditionHandler(stop("This is an error!"))
conditionHandler(1/"a")

VFP documentation built on Nov. 10, 2022, 5:12 p.m.

Related to conditionHandler in VFP...