method_with_error <- function() {
tryCatch(stop("test exception"),
error = function(e) {
# Any partial processing here,
# then send the error on
stop(e)
})
}
msg <- tryCatch(method_with_error(),
error = conditionMessage)
# msg = test exception
cat("msg =", msg, "\n")