Method: ActionDispatch::ExceptionWrapper#traces

Defined in:
actionpack/lib/action_dispatch/middleware/exception_wrapper.rb

#tracesObject



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'actionpack/lib/action_dispatch/middleware/exception_wrapper.rb', line 148

def traces
  application_trace_with_ids = []
  framework_trace_with_ids = []
  full_trace_with_ids = []
  application_traces = application_trace.map(&:to_s)

  full_trace = backtrace_cleaner&.clean_locations(backtrace, :all).presence || backtrace
  full_trace.each_with_index do |trace, idx|
    filtered_trace = backtrace_cleaner&.clean_frame(trace, :all) || trace

    trace_with_id = {
      exception_object_id: @exception.object_id,
      id: idx,
      trace: trace,
      filtered_trace: filtered_trace,
    }

    if application_traces.include?(filtered_trace.to_s)
      application_trace_with_ids << trace_with_id
    else
      framework_trace_with_ids << trace_with_id
    end

    full_trace_with_ids << trace_with_id
  end

  {
    "Application Trace" => application_trace_with_ids,
    "Framework Trace" => framework_trace_with_ids,
    "Full Trace" => full_trace_with_ids
  }
end