How to handle 404 errors with Ruby HTTP::Net?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-05-09T11:07:45Z Indexed on 2010/05/09 11:18 UTC
Read the original article Hit count: 438

Filed under:
|
|

Hi,

I'm trying to parse web pages but I sometimes get 404 errors. Here's the code I use to get the web page:

result = Net::HTTP::get URI.parse(URI.escape(url))

How do I test if result is a 404 error code?

Thank you,

Kevin

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails