Hi everyone,

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.

Best regards,
Ernest
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to