Created
October 31, 2012 14:07
-
-
Save hynkle/3987210 to your computer and use it in GitHub Desktop.
Raise As
This file contains 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
# for those times you want to bubble an exception up, but want to put it in a different exception class | |
module Kernel | |
def raise_as(exception_class) | |
raise if $!.nil? | |
raise exception_class, $!.message, $!.backtrace | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment