aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-15 10:05:46 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-15 10:05:46 -0500
commit90d7ae23c6f5a7e914d8b9fd74481ac61b6c4fb9 (patch)
tree1b371ce044be6079102190a43bfae9f5e749d440 /actionpack
parentd58ee2300854f4a5a4e0ff4b7e09f412eb2dc189 (diff)
downloadrails-90d7ae23c6f5a7e914d8b9fd74481ac61b6c4fb9.tar.gz
rails-90d7ae23c6f5a7e914d8b9fd74481ac61b6c4fb9.tar.bz2
rails-90d7ae23c6f5a7e914d8b9fd74481ac61b6c4fb9.zip
Remove global exception catching from ApplicationController.
It was severely broken since it was ported to NewBase and is causing problems with normal exception catching. A replacement is coming soon.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/dispatch/middlewares.rb10
-rw-r--r--actionpack/lib/action_controller/metal/rescuable.rb45
-rw-r--r--actionpack/test/controller/rescue_test.rb24
3 files changed, 19 insertions, 60 deletions
diff --git a/actionpack/lib/action_controller/dispatch/middlewares.rb b/actionpack/lib/action_controller/dispatch/middlewares.rb
index b25ed3fd3f..5641b3cb8d 100644
--- a/actionpack/lib/action_controller/dispatch/middlewares.rb
+++ b/actionpack/lib/action_controller/dispatch/middlewares.rb
@@ -4,15 +4,13 @@ use "Rack::Lock", :if => lambda {
use "ActionDispatch::ShowExceptions", lambda { ActionController::Base.consider_all_requests_local }
use "ActionDispatch::Callbacks", lambda { ActionController::Dispatcher.prepare_each_request }
-use "ActionDispatch::Rescue", lambda {
- controller = (::ApplicationController rescue ActionController::Base)
- # TODO: Replace with controller.action(:_rescue_action)
- controller.method(:rescue_action)
-}
+
+# TODO: Redirect global exceptions somewhere?
+# use "ActionDispatch::Rescue"
use lambda { ActionController::Base.session_store },
lambda { ActionController::Base.session_options }
use "ActionDispatch::ParamsParser"
use "Rack::MethodOverride"
-use "Rack::Head" \ No newline at end of file
+use "Rack::Head"
diff --git a/actionpack/lib/action_controller/metal/rescuable.rb b/actionpack/lib/action_controller/metal/rescuable.rb
index 029e643d93..bbca1b2179 100644
--- a/actionpack/lib/action_controller/metal/rescuable.rb
+++ b/actionpack/lib/action_controller/metal/rescuable.rb
@@ -1,52 +1,13 @@
module ActionController #:nodoc:
- # Actions that fail to perform as expected throw exceptions. These
- # exceptions can either be rescued for the public view (with a nice
- # user-friendly explanation) or for the developers view (with tons of
- # debugging information). The developers view is already implemented by
- # the Action Controller, but the public view should be tailored to your
- # specific application.
- #
- # The default behavior for public exceptions is to render a static html
- # file with the name of the error code thrown. If no such file exists, an
- # empty response is sent with the correct status code.
- #
- # You can override what constitutes a local request by overriding the
- # <tt>local_request?</tt> method in your own controller. Custom rescue
- # behavior is achieved by overriding the <tt>rescue_action_in_public</tt>
- # and <tt>rescue_action_locally</tt> methods.
module Rescue
extend ActiveSupport::Concern
-
- included do
- include ActiveSupport::Rescuable
- end
-
- module ClassMethods
- # This can be removed once we can move action(:_rescue_action) into middlewares.rb
- # Currently, it does controller.method(:rescue_action), which is hiding the implementation
- # difference between the old and new base.
- def rescue_action(env)
- action(:_rescue_action).call(env)
- end
- end
-
- attr_internal :rescued_exception
+ include ActiveSupport::Rescuable
private
- def method_for_action(action_name)
- return action_name if self.rescued_exception = request.env.delete("action_dispatch.rescue.exception")
- super
- end
-
- def _rescue_action
- rescue_with_handler(rescued_exception) || raise(rescued_exception)
- end
-
- def process_action(*)
+ def process_action(*args)
super
rescue Exception => exception
- self.rescued_exception = exception
- _rescue_action
+ rescue_with_handler(exception) || raise(exception)
end
end
end
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 23408712e9..e8ca1ad0ee 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -331,18 +331,18 @@ class RescueTest < ActionController::IntegrationTest
end
end
- test 'rescue routing exceptions' do
- assert_equal 1, ApplicationController.rescue_handlers.length
-
- begin
- with_test_routing do
- get '/no_way'
- assert_equal 'no way', response.body
- end
- ensure
- ActionController::Base.rescue_handlers.clear
- end
- end
+ # test 'rescue routing exceptions' do
+ # assert_equal 1, ApplicationController.rescue_handlers.length
+ #
+ # begin
+ # with_test_routing do
+ # get '/no_way'
+ # assert_equal 'no way', response.body
+ # end
+ # ensure
+ # ActionController::Base.rescue_handlers.clear
+ # end
+ # end
test 'unrescued exception' do
with_test_routing do