Class: ActionDispatch::ExceptionWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/exception_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#extract_sourcesObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/action_dispatch/exception_wrapper.rb', line 25

def extract_sources
  exception.backtrace.map do |trace|
    file, line  = trace.split(":")
    line_number = line.to_i

    {
      code: source_fragment(file, line_number) || {},
      file: file,
      line_number: line_number
    }
  end if exception.backtrace
end

#tracesObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/action_dispatch/exception_wrapper.rb', line 3

def traces
  appplication_trace_with_ids = []
  framework_trace_with_ids = []
  full_trace_with_ids = []

  if full_trace
    full_trace.each_with_index do |trace, idx|
      trace_with_id = { id: idx, trace: trace }

      appplication_trace_with_ids << trace_with_id if application_trace.include?(trace)
      framework_trace_with_ids << trace_with_id if framework_trace.include?(trace)
      full_trace_with_ids << trace_with_id
    end
  end

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