Permalink
Browse files

Merge pull request #12882 from charliesome/use-rescue-splat-in-suppress

Use rescue with a splat rather and catching all exceptions and manually filtering in Kernel#suppress
  • Loading branch information...
2 parents 54dde36 + 425f482 commit 416a9c73d3ddacd5c254aacd3a8b055b4c28092d @guilleiguaran guilleiguaran committed Nov 14, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 activesupport/lib/active_support/core_ext/kernel/reporting.rb
@@ -60,8 +60,7 @@ def silence_stream(stream)
# puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
def suppress(*exception_classes)
yield
- rescue Exception => e
- raise unless exception_classes.any? { |cls| e.kind_of?(cls) }
+ rescue *exception_classes => e
end
# Captures the given stream and returns it:

0 comments on commit 416a9c7

Please sign in to comment.