From 3697df1dd2be6e51867bea4d6089f01f8f204f3c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 23 Mar 2005 11:48:10 +0000 Subject: Improved error reporting especially around never shallowing exceptions. Debugging helpers should be much easier now #980 [Nicholas Seckar] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@984 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/object_and_class.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/lib/active_support/core_ext/object_and_class.rb') diff --git a/activesupport/lib/active_support/core_ext/object_and_class.rb b/activesupport/lib/active_support/core_ext/object_and_class.rb index eb54f79534..be486b0816 100644 --- a/activesupport/lib/active_support/core_ext/object_and_class.rb +++ b/activesupport/lib/active_support/core_ext/object_and_class.rb @@ -21,6 +21,13 @@ class Object #:nodoc: !self end end + + def suppress(*exception_classes) + begin yield + rescue Exception => e + raise unless exception_classes.any? {|cls| e.kind_of? cls} + end + end end class Class #:nodoc: -- cgit v1.2.3