Last data update: 2014.03.03

R: Raise a warning or error about a CURL problem
curlErrorR Documentation

Raise a warning or error about a CURL problem

Description

This function is called to raise an error or warning that arises from a curl operation when making a request. This is called from C code that encounters the error and this function is responsible for generating the error.

Usage

curlError(type, msg, asError = TRUE)

Arguments

type

the type of the error or a status code identifying the type of the error. Typically this is an integer value that identifies the type of the Curl error. The value corresponds to one of the enumerated value of type CURLcode.

msg

the error message, as a character vector of length 1

asError

a logical value that indicates whether to raise an error or a warning

Value

This calls warning or stop with the relevant condition object. The object is always of basic (S3) class GenericCurlError, error, condition or GenericCurlError, warning, condition. When the type value corresponds to a CURLCode value, the condition has the primary class given by that CURLCode's name, e.g. COULDNT_RESOLVE_HOST, TOO_MANY_REDIRECTS (with the CURLE prefix removed).

Author(s)

Duncan Temple Lang

References

libcurl documentation.

See Also

curlPerform

Examples

  # This illustrates generating and catching an error.
  # We intentionally give a mis-spelled URL.
 tryCatch(curlPerform(url = "ftp.wcc.nrcs.usda.govx"),
          COULDNT_RESOLVE_HOST = function(x) cat("resolve problem\n"),
          error = function(x) cat(class(x), "got it\n"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RCurl)
Loading required package: bitops
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RCurl/curlError.Rd_%03d_medium.png", width=480, height=480)
> ### Name: curlError
> ### Title: Raise a warning or error about a CURL problem
> ### Aliases: curlError
> ### Keywords: programming IO
> 
> ### ** Examples
> 
>   # This illustrates generating and catching an error.
>   # We intentionally give a mis-spelled URL.
>  tryCatch(curlPerform(url = "ftp.wcc.nrcs.usda.govx"),
+           COULDNT_RESOLVE_HOST = function(x) cat("resolve problem\n"),
+           error = function(x) cat(class(x), "got it\n"))
resolve problem
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>