[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Catching Errno::ETIMEDOUT

Horacio Sanson

12/12/2005 2:23:00 AM


This is a little method I use to download webpages. It works ok until I
started receiving some Errno::ETIMEDOUT errors that cause my script to fail.

I tried rescuing this error using recue Timeout::Error but it doesn't work.

Any ideas how can I catch this error to avoid the script to fail and just
ignore the error??


def connect
# Do we have a url to process do we?? if not simply return
if not @uri
return nil
end

begin
h = Net::HTTP.new(@uri.host, @uri.port)
h.use_ssl = true if @uri.scheme == "https"
@resp = h.get(@uri.request_uri, nil )

rescue SocketError
@resp = Net::HTTPNotFound.new(1.1, 404, "Not Found")
end

return @resp
end




thanks
Horacio


5 Answers

Eero Saynatkari

12/12/2005 7:58:00 PM

0

Horacio Sanson wrote:
> This is a little method I use to download webpages. It works ok until I
> started receiving some Errno::ETIMEDOUT errors that cause my script to
> fail.
>
> I tried rescuing this error using recue Timeout::Error but it doesn't
> work.
>
> Any ideas how can I catch this error to avoid the script to fail and
> just
> ignore the error??
>
>
> def connect
> # Do we have a url to process do we?? if not simply
> return
> if not @uri
> return nil
> end
>
> begin
> h = Net::HTTP.new(@uri.host, @uri.port)
> h.use_ssl = true if @uri.scheme == "https"
> @resp = h.get(@uri.request_uri, nil )
>
> rescue SocketError
> @resp = Net::HTTPNotFound.new(1.1, 404, "Not
> Found")
> end
>
> return @resp
> end

Try to rescue SystemCallError (all off the Errno
should fall in this category) or Exception.

> thanks
> Horacio

E

--
Posted via http://www.ruby-....


Lamont Cranston

12/23/2011 9:08:00 PM

0


In article<2a1b4$4ef37ea3$4107e27c$16567@news.flashnewsgroups.com>,
"Bob"<dalnetbob@att.net> wrote:
>
> Obama's speech today is more evidence of a stealth Marxist.

Boob again reveals that he has no fucking clue as to what a Marxist is.

rfischer

12/23/2011 10:43:00 PM

0

Lamont Cranston <TLC@TheShadowKnows.com> wrote:
> "Bob"<dalnetbob@att.net> wrote:
>>
>> Obama's speech today is more evidence of a stealth Marxist.
>
>Boob again reveals that he has no fucking clue as to what a Marxist is.

You could have written six fewer words.

--
Ray Fischer | None are more hopelessly enslaved than those who falsely believe they are free.
rfischer@sonic.net | Goethe

Buster Norris

12/24/2011 2:56:00 AM

0

Summary: Lammy is a classic usenet zoo monkey. Liars, once they have
been exposed, frequently revert to behavior most similar to a zoo
monkey who sits in the cage throwing feces at passersby but saying
nothing of value. Note that when you reply to a Proven Liar you
encourage them to continue lying.

[][][][][][]


The DemocRAT Hall Of Shame http://www.democrathallof... asks
"Why do you always LIE?"

[Courtesy of Buster Norris]

On Tue, 19 Apr 2011 17:13:26 -0700, Lamont Cranston
<Lamont.Cranston@FogYourMind.com> wrote:
>On 4/19/2011 12:08 PM, Alfred stomacker wrote:
>> paid in by Saudi prince . low scores hidden .
>Simply a racist lie.

Obama Had Close Ties to Top Saudi Adviser at Early Age
http://www.newsmax.com/KenTimmerman/obama-sutton-saudi/2008/09/03...

Obama's Benefactor: Dr. Khalid al Mansour
http://atlasshrugs2000.typepad.com/atlas_shrugs/2008/08/obamas-ben...

Posted from:
The DemocRATs Hall of Shame!
http://www.democrathallof...

Raymond C. Fischer, 90 Hunt Way, Campbell, CA 95008; 408-374-1969

12/24/2011 2:56:00 AM

0

Summary: Ray is a classic usenet zoo monkey. Liars, once they have
been exposed, frequently revert to behavior most similar to a zoo
monkey who sits in the cage throwing feces at passersby but saying
nothing of value. Note that when you reply to a Proven Liar you
encourage them to continue lying.

Raymond C. Fischer (54)
(Louise Fischer)
90 Hunt Way
Campbell, CA 95008
408-374-1969

[][][][][][]
The DemocRAT Hall Of Shame http://www.democrathallof... asks
"Why do you always LIE?"

[Courtesy of Buster Norris]

On 03 Jul 2011 23:25:37 GMT, rfischer@sonic.net (Ray Fischer) wrote:
>>For heading on to five years, the Democrats have controlled two of the
>>three arms of the Executive, Senate and House triangle of power.
>Steel is lying outright, yet again, as a way of avoiding the question.

LIAR!!!!!!!!!!!!!!!!!

2011- Executive, Senate.
2010- Executive, Senate.
2009- Executive, Senate, House.
2008- Senate, House.
2007- Senate, House.

Posted from:
The DemocRATs Hall of Shame!
http://www.democrathallof...