Parent

Methods

Class/Module Index [+]

Quicksearch

ActionDispatch::ShowExceptions

This middleware rescues any exception returned by the application and renders nice exception pages if it’s being rescued locally.

Public Class Methods

new(app, consider_all_requests_local = false) click to toggle source
# File lib/action_dispatch/middleware/show_exceptions.rb, line 40
def initialize(app, consider_all_requests_local = false)
  @app = app
  @consider_all_requests_local = consider_all_requests_local
end

Public Instance Methods

call(env) click to toggle source
# File lib/action_dispatch/middleware/show_exceptions.rb, line 45
def call(env)
  begin
    status, headers, body = @app.call(env)
    exception = nil

    # Only this middleware cares about RoutingError. So, let's just raise
    # it here.
    if headers['X-Cascade'] == 'pass'
       raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
    end
  rescue Exception => exception
    raise exception if env['action_dispatch.show_exceptions'] == false
  end

  exception ? render_exception(env, exception) : [status, headers, body]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.