diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-06 08:17:08 -0700 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-06 08:17:08 -0700 |
commit | b7f2ccd77ac6767b89908523cc4a4ee34fa9f145 (patch) | |
tree | 97d493ad185ef3ab12129a1efb596b1aa3b67ef5 | |
parent | 48e3c462a2fad7944dcebc54b2ab9fe423f43ffb (diff) | |
parent | a0907bbdad0b8cbead9c8d295b9037036ec650d0 (diff) | |
download | rails-b7f2ccd77ac6767b89908523cc4a4ee34fa9f145.tar.gz rails-b7f2ccd77ac6767b89908523cc4a4ee34fa9f145.tar.bz2 rails-b7f2ccd77ac6767b89908523cc4a4ee34fa9f145.zip |
Merge pull request #11780 from thedarkone/logger-naked-rescue-fix
Rack::Logger naked rescue fix
-rw-r--r-- | railties/lib/rails/rack/logger.rb | 2 | ||||
-rw-r--r-- | railties/test/rack_logger_test.rb | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb index ad5fdcf648..ef4cdcb080 100644 --- a/railties/lib/rails/rack/logger.rb +++ b/railties/lib/rails/rack/logger.rb @@ -38,7 +38,7 @@ module Rails resp = @app.call(env) resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) } resp - rescue + rescue Exception finish(request) raise ensure diff --git a/railties/test/rack_logger_test.rb b/railties/test/rack_logger_test.rb index cfd2c5b50a..6ebd47fff9 100644 --- a/railties/test/rack_logger_test.rb +++ b/railties/test/rack_logger_test.rb @@ -1,3 +1,4 @@ +require 'abstract_unit' require 'active_support/testing/autorun' require 'active_support/test_case' require 'rails/rack/logger' @@ -56,11 +57,14 @@ module Rails end def test_notification_on_raise - logger = TestLogger.new { raise } + logger = TestLogger.new do + # using an exception class that is not a StandardError subclass on purpose + raise NotImplementedError + end assert_difference('subscriber.starts.length') do assert_difference('subscriber.finishes.length') do - assert_raises(RuntimeError) do + assert_raises(NotImplementedError) do logger.call 'REQUEST_METHOD' => 'GET' end end |