Skip to content

Instantly share code, notes, and snippets.

@nyx
Created June 21, 2011 18:18
Show Gist options
  • Save nyx/1038497 to your computer and use it in GitHub Desktop.
Save nyx/1038497 to your computer and use it in GitHub Desktop.
custom messages on exceptions
require 'httparty'
class Rocker
include HTTParty
def initialize(timeout = 1)
self.class.default_timeout(timeout)
end
def rock
self.class.get("http://127.0.0.1:1337/")
rescue Timeout::Error => e
raise e, "fuuu"
end
end
begin
Rocker.new.rock
rescue Timeout::Error => e
puts e.message
puts e.class
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment