class ActionDispatch::DebugExceptions

def render_exception(request, exception, wrapper)

def render_exception(request, exception, wrapper)
  log_error(request, wrapper)
  if request.get_header("action_dispatch.show_detailed_exceptions")
    begin
      content_type = request.formats.first
    rescue ActionDispatch::Http::MimeNegotiation::InvalidType
      content_type = Mime[:text]
    end
    if api_request?(content_type)
      render_for_api_request(content_type, wrapper)
    else
      render_for_browser_request(request, wrapper)
    end
  else
    raise exception
  end
end