Did you try a rescue block:
begin
response = Net::HTTP.start(host).request_head('/')
rescue SocketError => e
# Handle error
end
--
Darian Shimy
http://www.darianshimy.com
http://twitter.com/dshimy
On Fri, Nov 13, 2009 at 9:40 AM, jhaagmans <[email protected]> wrote:
>
> Hi,
>
> I'm doing this:
>
> response = Net::HTTP.start(host).request_head('/')
>
> To check a domain for its response. Now some of the domains checked
> will not exist and thus produce the following error:
>
> SocketError: getaddrinfo: Name or service not known
>
> But I don't want my application to fail when this happens, I just want
> the response to be nil. How can this be done?
>
> Thank you!
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---