in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

Viewing server errors with open-uri

I've been doing some testing using open-uri but when my server returned an http 500 all I got on the ruby side was an Open::HTTPError. In order to view the actual error page returned by the server I needed to do something like this:

 

begin    
  resp = open(URL)
  puts "Finished"
rescue OpenURI::HTTPError => err
  puts "Failed"
  puts err.io.readlines
end
Published Sep 05 2007, 06:49 AM by chrisortman
Filed under:

Comments

No Comments

Leave a Comment

(required)
(optional)
(required)
Add
Powered by Community Server (Commercial Edition), by Telligent Systems