diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/kernel/reporting.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/kernel/reporting.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/kernel/reporting.rb b/activesupport/lib/active_support/core_ext/kernel/reporting.rb index a5cec50245..0f101e8fa4 100644 --- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb +++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb @@ -42,6 +42,14 @@ module Kernel stream.reopen(old_stream) end + # Blocks and ignores any exception passed as argument if raised within the block. + # + # suppress(ZeroDivisionError) do + # 1/0 + # puts "This code is NOT reached" + # end + # + # puts "This code gets executed and nothing related to ZeroDivisionError was seen" def suppress(*exception_classes) begin yield rescue Exception => e |