httr (version 0.6.0)

safe_callback: Generate a safe R callback.

Description

Whenever an R callback function is passed to Rcurl, it needs to be wrapped in this handler which converts errors and interrupts to the appropriate values that cause RCurl to terminate a request

Usage

safe_callback(f)

Arguments

f
A function.

Examples

Run this code
f1 <- function(x) {
  if (x < 0) stop("Negative value")
  sqrt(x)
}
f2 <- safe_callback(f1)
f2(-10)

Run the code above in your browser using DataLab