With tryCatch you can handle errors as you want:
an.error.occured <- FALSE
tryCatch( { result <- log("not a number"); print(res) }
, error = function(e) {an.error.occured <<- TRUE})
print(an.error.occured)
## [1] TRUE
If you use an error handler function
- the error is not shown anymore and
- the execution continues after the tryCatch statement.