Re: [Rd] [R] Catching a RCurl error?

From: Janko Thyson <janko.thyson_at_ku-eichstaett.de>
Date: Tue, 23 Nov 2010 14:56:09 +0100

> -----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 http://curl.haxx.se/libcurl/c/libcurl-tutorial.html).

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 solution

##### 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.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 23 Nov 2010 - 13:59:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 23 Nov 2010 - 21:20:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive