lib/action_dispatch/middleware/debug_exceptions.rb in actionpack-4.2.0.beta4 vs lib/action_dispatch/middleware/debug_exceptions.rb in actionpack-4.2.0.rc1

- old
+ new

@@ -33,14 +33,14 @@ wrapper = ExceptionWrapper.new(env, exception) log_error(env, wrapper) if env['action_dispatch.show_detailed_exceptions'] request = Request.new(env) - traces = traces_from_wrapper(wrapper) + traces = wrapper.traces trace_to_show = 'Application Trace' - if traces[trace_to_show].empty? + if traces[trace_to_show].empty? && wrapper.rescue_template != 'routing_error' trace_to_show = 'Full Trace' end if source_to_show = traces[trace_to_show].first source_to_show_id = source_to_show[:id] @@ -51,11 +51,11 @@ exception: wrapper.exception, traces: traces, show_source_idx: source_to_show_id, trace_to_show: trace_to_show, routes_inspector: routes_inspector(exception), - source_extract: wrapper.source_extract, + source_extracts: wrapper.source_extracts, line_number: wrapper.line_number, file: wrapper.file ) file = "rescues/#{wrapper.rescue_template}" @@ -103,36 +103,8 @@ def routes_inspector(exception) if @routes_app.respond_to?(:routes) && (exception.is_a?(ActionController::RoutingError) || exception.is_a?(ActionView::Template::Error)) ActionDispatch::Routing::RoutesInspector.new(@routes_app.routes.routes) end - end - - # Augment the exception traces by providing ids for all unique stack frame - def traces_from_wrapper(wrapper) - application_trace = wrapper.application_trace - framework_trace = wrapper.framework_trace - full_trace = wrapper.full_trace - - appplication_trace_with_ids = [] - framework_trace_with_ids = [] - full_trace_with_ids = [] - - if full_trace - full_trace.each_with_index do |trace, idx| - id_trace = { - id: idx, - trace: trace - } - appplication_trace_with_ids << id_trace if application_trace.include? trace - framework_trace_with_ids << id_trace if framework_trace.include? trace - full_trace_with_ids << id_trace - end - end - { - "Application Trace" => appplication_trace_with_ids, - "Framework Trace" => framework_trace_with_ids, - "Full Trace" => full_trace_with_ids - } end end end