if (FALSE) {
# Play a "ping" sound if \code{expr} produces an error
beep_on_error(log("foo"))
# Stay silent if \code{expr} does not produce an error
beep_on_error(log(1))
# Play the Wilhelm scream instead of a ping on error.
beep_on_error(runif("bar"), "wilhelm")
}
Run the code above in your browser using DataLab