File: curlError.Rd

package info (click to toggle)
r-cran-rcurl 1.95-4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,140 kB
  • ctags: 515
  • sloc: ansic: 3,135; xml: 1,734; asm: 993; sh: 12; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
\name{curlError}
\alias{curlError}
\title{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)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{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 \code{CURLcode}.}
  \item{msg}{the error message, as a character vector of length 1}
  \item{asError}{a logical value that indicates whether to raise an
    error or a warning}
}
\value{
 This calls \code{warning} or \code{stop} with the relevant condition
 object.
 The object is always of basic  (S3) class
 \code{GenericCurlError, error, condition}
 or
 \code{GenericCurlError, warning, condition}.
 When the \code{type} value corresponds to a
 \code{CURLCode} value, the condition has the primary class given by that
 \code{CURLCode}'s name, e.g. \code{COULDNT_RESOLVE_HOST},
  \code{TOO_MANY_REDIRECTS} (with the CURLE prefix removed).

}
\references{
libcurl documentation.
}
\author{
Duncan Temple Lang
}

\seealso{
\code{\link{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"))
}
\keyword{programming} 
\keyword{IO}
\concept{error handling}