<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -112,19 +112,23 @@ module ActionController #:nodoc:
     protected
       # Exception handler called when the performance of an action raises an exception.
       def rescue_action(exception)
-        log_error(exception) if logger
-        erase_results if performed?
+        if handler_for_rescue(exception)
+          rescue_action_with_handler(exception)
+        else
+          log_error(exception) if logger
+          erase_results if performed?
 
-        # Let the exception alter the response if it wants.
-        # For example, MethodNotAllowed sets the Allow header.
-        if exception.respond_to?(:handle_response!)
-          exception.handle_response!(response)
-        end
+          # Let the exception alter the response if it wants.
+          # For example, MethodNotAllowed sets the Allow header.
+          if exception.respond_to?(:handle_response!)
+            exception.handle_response!(response)
+          end
 
-        if consider_all_requests_local || local_request?
-          rescue_action_locally(exception)
-        else
-          rescue_action_in_public(exception)
+          if consider_all_requests_local || local_request?
+            rescue_action_locally(exception)
+          else
+            rescue_action_in_public(exception)
+          end
         end
       end
 
@@ -200,7 +204,7 @@ module ActionController #:nodoc:
       def perform_action_with_rescue #:nodoc:
         perform_action_without_rescue
       rescue Exception =&gt; exception
-        rescue_action_with_handler(exception) || rescue_action(exception)
+        rescue_action(exception)
       end
 
       def rescues_path(template_name)</diff>
      <filename>actionpack/lib/action_controller/rescue.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,6 +62,11 @@ class RescueController &lt; ActionController::Base
     render :text =&gt; exception.message
   end
 
+  # This is a Dispatcher exception and should be in ApplicationController.
+  rescue_from ActionController::RoutingError do
+    render :text =&gt; 'no way'
+  end
+
   def raises
     render :text =&gt; 'already rendered'
     raise &quot;don't panic!&quot;
@@ -378,6 +383,10 @@ class RescueTest &lt; Test::Unit::TestCase
     assert_equal &quot;RescueController::ResourceUnavailableToRescueAsString&quot;, @response.body
   end
 
+  def test_rescue_dispatcher_exceptions
+    RescueController.process_with_exception(@request, @response, ActionController::RoutingError.new(&quot;Route not found&quot;))
+    assert_equal &quot;no way&quot;, @response.body
+  end
 
   protected
     def with_all_requests_local(local = true)</diff>
      <filename>actionpack/test/controller/rescue_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c64d749abdf31a2be322b1787165024067abbda7</id>
    </parent>
  </parents>
  <author>
    <name>Pratik Naik</name>
    <login>lifo</login>
    <email>pratiknaik@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/90c930f45c5c6766306929241462ffff8f67b86e</url>
  <id>90c930f45c5c6766306929241462ffff8f67b86e</id>
  <committed-date>2008-07-16T10:54:08-07:00</committed-date>
  <authored-date>2008-07-16T10:51:40-07:00</authored-date>
  <message>Allow Dispatcher exceptions to be handled in application.rb using rescue_from</message>
  <tree>0c8a34193358991700b5142afdb4386af3d09d3b</tree>
  <committer>
    <name>Pratik Naik</name>
    <login>lifo</login>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
