From 3c9bf6e1dc3066e32651c955c6e237488115354d Mon Sep 17 00:00:00 2001 From: Thiago Pradi Date: Sat, 11 Sep 2010 11:00:37 -0300 Subject: Exception handling more readable [#5601 state:committed] Signed-off-by: Santiago Pastorino --- activesupport/lib/active_support/cache.rb | 4 ++-- activesupport/lib/active_support/testing/performance.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index df35540b55..9098ffbfec 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -61,8 +61,8 @@ module ActiveSupport store_class = begin require "active_support/cache/#{store}" - rescue LoadError - raise "Could not find cache store adapter for #{store} (#{$!})" + rescue LoadError => e + raise "Could not find cache store adapter for #{store} (#{e})" else ActiveSupport::Cache.const_get(store_class_name) end diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb index f7ddf6421d..64b436ba8c 100644 --- a/activesupport/lib/active_support/testing/performance.rb +++ b/activesupport/lib/active_support/testing/performance.rb @@ -58,16 +58,16 @@ begin metric.send(mode) { __send__ @method_name } rescue ::Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) - rescue StandardError, ScriptError - add_error($!) + rescue StandardError, ScriptError => e + add_error(e) ensure begin teardown run_callbacks :teardown, :enumerator => :reverse_each rescue ::Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) - rescue StandardError, ScriptError - add_error($!) + rescue StandardError, ScriptError => e + add_error(e) end end -- cgit v1.2.3