attempt (version 0.3.1)

on_error: Add a function to be run on error

Description

This function behaves as `on.exit()`, but is run on error, and supports mappers.

Usage

on_error(f)

Arguments

f

a function to call on error

Value

A local error handler.

Examples

Run this code
# NOT RUN {
y <- function(num){
  on_error(~ write( Sys.time(), "error_log.txt", append = TRUE) )
  log(num)
}

# }

Run the code above in your browser using DataLab