Sha256: ced820c3e9eef818f8f34717049cd6a114f506bceb06d53fca915e50ff5014dd

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module ActionDispatch
  class ExceptionWrapper
    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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
web-console-2.0.0 lib/action_dispatch/exception_wrapper.rb