[Rd] [R] Catching a RCurl error?

Janko Thyson janko.thyson at ku-eichstaett.de
Tue Nov 23 14:56:09 CET 2010

> -----Ursprüngliche Nachricht-----
> Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> Im Auftrag von Tal Galili
> Gesendet: Dienstag, 23. November 2010 14:18
> An: r-help at r-project.org
> Betreff: [R] Catching a RCurl error?
> Hi all,
> I'm running a complex script which accesses the internet, and sometimes
> it
> stops with the error:
> Error in curlPerform(url = url, headerfunction = header$update, curl =
> curl,
> >  :
>   Failure when receiving data from the peer
> Is there a way to make the script "wait" longer, or not crash when this
> error happens?
> (I'm wondering if this should be done in the level of tryCatch, or by
> playing with some parameter in the RCurl options)
> Thanks,
> Tal

That's a question that also popped up in my work. You can definitely tune
timeouts in the options (e.g. one options of interest in that respect is
CURLOPT_TIMEOUT, which I think is lowercase in the R implementation; there
are others, too; check http://curl.haxx.se/docs/manual.html and

Generally there's a lot of stuff you can specify but I haven't found a way
yet to use some sort of an "internal error control". Putting a tryCatch() or
try() wrapper around your CURL request is nice and good, but the error of
interest usually happens "inside" (or "with") the actual request which in my
case usually freezes the routine, so control is never handed back to R -->
try() was useless for me.

If you find something in that respect I'd be also very interested in your

##### SYSTEM INFO #####
Windows XP SP3
R 2.12.0 (patched as of 2010-11-22)
Eclipse 3.6.1 (Helios)
StatET 0.9.x

> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
> |
> www.r-statistics.com (English)
> -----------------------------------------------------------------------
> -----------------------
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-devel mailing list