Created
June 21, 2011 18:18
-
-
Save nyx/1038497 to your computer and use it in GitHub Desktop.
custom messages on exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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