Skip to content
Browse files

Merge pull request #11780 from thedarkone/logger-naked-rescue-fix

Rack::Logger naked rescue fix
  • Loading branch information...
2 parents 48e3c46 + a0907bb commit b7f2ccd77ac6767b89908523cc4a4ee34fa9f145 @guilleiguaran guilleiguaran committed Aug 6, 2013
Showing with 7 additions and 3 deletions.
  1. +1 −1 railties/lib/rails/rack/logger.rb
  2. +6 −2 railties/test/rack_logger_test.rb
View
2 railties/lib/rails/rack/logger.rb
@@ -38,7 +38,7 @@ def call_app(request, env)
resp = @app.call(env)
resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
resp
- rescue
+ rescue Exception
finish(request)
raise
ensure
View
8 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 @@ def test_notification
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

0 comments on commit b7f2ccd

Please sign in to comment.
Something went wrong with that request. Please try again.