Skip to content

Instantly share code, notes, and snippets.

@benprew
Created September 25, 2013 18:58
Show Gist options
  • Save benprew/6704304 to your computer and use it in GitHub Desktop.
Save benprew/6704304 to your computer and use it in GitHub Desktop.
agent = Mechanize.new
href = 'http://www.google.com/not_found'
begin
page = agent.get(href)
rescue StandardError => e
if e.to_s =~ /404/
puts "Page #{href} not found"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment