Module: Failbot::DefaultBacktraceParser

Defined in:
lib/failbot/default_backtrace_parser.rb

Overview

This is the default backtrace parser for the Structured formatter.

Constant Summary collapse

EMPTY_ARRAY =
[].freeze

Class Method Summary collapse

Class Method Details

.call(exception) ⇒ Object

Takes an Exception instance, returns an array of hashes with the keys that the Structured formatter expects.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/failbot/default_backtrace_parser.rb', line 8

def self.call(exception)
  if exception.backtrace
    Backtrace.parse(exception.backtrace).frames.reverse.map do |line|
      {
        "filename" => line.file_name,
        "abs_path" => line.abs_path,
        "lineno"   => line.line_number,
        "function" => line.method
      }
    end
  else
    EMPTY_ARRAY
  end
end