tcwarn: tryCatch with warning

View source: R/tcwarn.R

tcwarnR Documentation

tryCatch with warning

Description

Easy Try/Catch implementation to return the same message as a warning on error or warning. Makes it easier to write tryCatches. Author: Bryce Chamberlain. Tech review: Lindsay Smelzter.

Usage

tcwarn(code_block, ...)

Arguments

code_block

Code to run in Try Catch.

...

Strings to concatenate to form the message that is returned.

Examples

tryCatch({
   tcwarn({ NULL = 1 },'Cannot assign to NULL','variable') 
 }, 
 warning = function(e) print( e ) 
)

tryCatch({ 
   tcwarn({ as.numeric('abc') },'Issue in as.numeric()') 
 }, 
 warning = function(e) print( e )
)

easyr documentation built on March 31, 2023, 6:22 p.m.

Related to tcwarn in easyr...