[Rd] [tryExcept] New try Function
ebenedito@ @ending from gm@il@com
Thu Nov 22 23:51:31 CET 2018
When dealing with errors, sometimes I want to run a bunch of code when an error occurs.
For now I usually use a structure such as:
res <- tryCatch(expr, error = function(cond) cond) # or try(expr)
if (inherits(res, “error”)) # or inherits(res, “try-error”)
# a bunch of code
I though it would be useful to have a function that does this naturally, so I came up with the attached function.
I would be glad to hear your insights and if you think it would make sense to add this function to R.
More information about the R-devel