Error Handling

Table of Contents

Retry a statement on error howto

ret = NULL
attempt = 0
MAX_ATTEMPT = 100
while (is.null(ret) & attempt < MAX_ATTEMPT) {
  attempt = attempt + 1
  try({
    ret = functionMayFail()
  }, silent = TRUE)
}
stopifnot(!is.null(ret))