try_it: Custom trycatch block

Description Usage Arguments Value Examples

View source: R/FUN.R

Description

Custom trycatch block, print a message according type of the error the invalid_args class error is always an arg failure the invalid class error is when an error is expected & the function must be stopped the error class is in the case of an unexpected error: it will record all parameters & the function where it happened

Usage

1
try_it(expr, params, return_object = NULL, shiny = FALSE)

Arguments

expr

R expression to try

params

a list with the function name & the parameters used to record in a RDS file

return_object

the object to return if the R expression doesn't work

shiny

boolean, use of sweetAlert from shinyWidgets pkg or not (only if a shiny session existed)

Value

the return_object argument

Examples

1
2
3
## Not run: try_it(check_arg("NA" != "a", "NA is always NA"), 
     list(func = "try_it", params = list(`NA`= "a")), FALSE)
## End(Not run)

shutinet/metabSeek documentation built on Sept. 5, 2020, 12:57 a.m.