def dispatch_exception(exception)
      if(exception.is_a?(Merb::ControllerExceptions::Base) &&
         !exception.is_a?(Merb::ControllerExceptions::ServerError))
        Merb.logger.info(Merb.exception(exception))
      else
        Merb.logger.error(Merb.exception(exception))
      end
      
      exceptions = env["merb.exceptions"] = [exception]
      
      begin
        e = exceptions.first
        
        if action_name = e.action_name
          dispatch_action(Exceptions, action_name, e.class.status)
        else
          dispatch_action(Dispatcher::DefaultException, :index, e.class.status)
        end
      rescue Object => dispatch_issue
        if e.same?(dispatch_issue) || exceptions.size > 5
          dispatch_action(Dispatcher::DefaultException, :index, e.class.status)
        else
          Merb.logger.error("Dispatching #{e.class} raised another error.")
          Merb.logger.error(Merb.exception(dispatch_issue))
          
          exceptions.unshift dispatch_issue
          retry
        end
      end
    end
def dispatch_exception(exception)
      if(exception.is_a?(Merb::ControllerExceptions::Base) &&
         !exception.is_a?(Merb::ControllerExceptions::ServerError))
        Merb.logger.info(Merb.exception(exception))
      else
        Merb.logger.error(Merb.exception(exception))
      end
      
      exceptions = env["merb.exceptions"] = [exception]
      
      begin
        e = exceptions.first
        
        if action_name = e.action_name
          dispatch_action(Exceptions, action_name, e.class.status)
        else
          dispatch_action(Dispatcher::DefaultException, :index, e.class.status)
        end
      rescue Object => dispatch_issue
        if e.same?(dispatch_issue) || exceptions.size > 5
          dispatch_action(Dispatcher::DefaultException, :index, e.class.status)
        else
          Merb.logger.error("Dispatching #{e.class} raised another error.")
          Merb.logger.error(Merb.exception(dispatch_issue))
          
          exceptions.unshift dispatch_issue
          retry
        end
      end
    end
Re-route the current request to the Exception controller if it is
 available, and try to render the exception nicely.

 You can handle exceptions by implementing actions for specific
 exceptions such as not_found or for entire classes of exceptions
 such as client_error. You can also implement handlers for
 exceptions outside the Merb exception hierarchy (e.g.
 StandardError is caught in standard_error).

 ==== Parameters
 exception<Object>::
   The exception object that was created when trying to dispatch the
   original controller.

 ==== Returns
 Array[Integer, Hash, #each]:: A Rack response

 :api: private