grapes-except-grapes: Try to evaluate an expressions and evaluate another...

%except%R Documentation

Try to evaluate an expressions and evaluate another expression on exception

Description

Try to evaluate an expressions and evaluate another expression on exception

Usage

try %except% except

Arguments

try

R expression

except

fallback R expression to be evaluated if try fails

Note

Suppress log messages in the except namespace if you don't want to throw a WARN log message on the exception branch.

Examples

everything %except% 42
everything <- "640kb"
everything %except% 42

FunDoesNotExist(1:10) %except% sum(1:10) / length(1:10)
FunDoesNotExist(1:10) %except% (sum(1:10) / length(1:10))
FunDoesNotExist(1:10) %except% MEAN(1:10) %except% mean(1:10)
FunDoesNotExist(1:10) %except% (MEAN(1:10) %except% mean(1:10))

logger documentation built on Oct. 30, 2024, 9:24 a.m.