It is perfect to catch only some errors, leaving others to the external handler or no handler at all. The error system is quite a bit more flexible than commonly used, so you can create your own type of error to re-throw the error
ourError <- function(original, message, class="ourError") { msg <- paste(message, conditionMessage(original), sep="\n ") structure(list(message = msg, call = conditionCall(original)), class = c(class, class(original))) }
and throw and / or process that
tryCatch(vec*parameter1, error=function(e) { err <- ourError(e, "addition fatal info; script aborted") stop(err) })
One of the advantages of this is that you can specify additional types of behavior in the top-level handler using the class returned by ourError()
tryCatch({ tryCatch(stop("oops"), error=function(e) { err <- ourError(e, "addition fatal info; script aborted", c("fatal", "ourError")) stop(err) }) }, ourError=function(err) { message("We caught but didn't handle this:\n", err) }, error =function(err) { message("This one got away: ", err) })
source share