# descriptive raise
# normale: raise 1 == TypeError: exception class/object expected
# now: raise 1 == RuntimeError: 1
class Object
def raise_with_helpfulness(*args)
raise_without_helpfulness(*args)
rescue TypeError => e
raise_without_helpfulness args.first.inspect if e.to_s == 'exception class/object expected'
raise e
end
alias_method_chain :raise, :helpfulness

1 comment
Comments feed for this article
October 19, 2009 at 12:57
gauda
thanks for sharing dude!