Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created April 18, 2012 03:45
Show Gist options
  • Save anildigital/a184b92b2e9624e0b2fd to your computer and use it in GitHub Desktop.
Save anildigital/a184b92b2e9624e0b2fd to your computer and use it in GitHub Desktop.
module Less
class Error < ::StandardError
def initialize(msg)
puts "<<<<" + msg + ">>>>"
super(msg)
end
end
class StandardError < Exception
def initialize(msg)
puts "BAD BAD BAD"
super(msg)
end
end
end
class Awesome
include Less
def something
raise Error, "This is bad bad bad"
end
end
a = Awesome.new
a.something
<<<<This is bad bad bad>>>>
/Users/anil.wadghule/Code/ruby/exception_hierarchy_test.rb:26:in `something': This is bad bad bad (Less::Error)
from /Users/anil.wadghule/Code/ruby/exception_hierarchy_test.rb:34:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment