tryCatch(stop("oops"), error=function(e) stop(e))
will re-signal the stop condition, although the context has been lost
> tryCatch(stop("oops"), error=function(e) stop(e)) Error in doTryCatch(return(expr), name, parentenv, handler) : oops > traceback() 5: stop(e) 4: value[[3L]](cond) 3: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 2: tryCatchList(expr, classes, parentenv, handlers) 1: tryCatch(stop("oops"), error = function(e) stop(e)) > tryCatch(stop("oops")) Error in tryCatchList(expr, classes, parentenv, handlers) : oops > traceback() 3: stop("oops") 2: tryCatchList(expr, classes, parentenv, handlers) 1: tryCatch(stop("oops"))
The return of only e , as @tonytonov suggests, indicates that a condition has occurred, but not that an error has occurred.
Martin morgan
source share