Skip to content

Instantly share code, notes, and snippets.

@kastiglione
Last active December 14, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastiglione/5083778 to your computer and use it in GitHub Desktop.
Save kastiglione/5083778 to your computer and use it in GitHub Desktop.
Rescue on more than just exception type.
module UncaughtThrowError
def self.===(ex)
ArgumentError === ex && ex.message =~ /uncaught throw/
end
end
begin
throw :foo
rescue UncaughtThrowError
puts 'Success: Rescued UncaughtThrowError'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment