R/berate.R

Defines functions berate .onAttach .onLoad

Documented in berate

berate <- function(err) {

  if (stats::runif(1) < 0.1) { return(invisible()) }

  msg <- tryCatch(html_text(html_nodes(read_html("http://www.programmerinsults.com/"), "h1")),
                  error=function(err) { return("\\_(o_O)_/") })
  cat(msg)

}

.onAttach <- function(libname, pkgname) {
 options(error=berate)
}

.onLoad <- function(libname, pkgname) {
 options(error=berate)
}
hrbrmstr/berate documentation built on May 17, 2019, 4:55 p.m.