Class: Failbot::Backtrace

Inherits:
Object
  • Object
show all
Defined in:
lib/failbot/backtrace.rb

Overview

A simple parser to extract structure from ruby backtraces.

See docs.sentry.io/development/sdk-dev/event-payloads/stacktrace/ for details on what data can sent

Defined Under Namespace

Classes: Frame

Constant Summary collapse

ParseError =

Raised when a line fails parsing.

Class.new(StandardError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frames) ⇒ Backtrace

Returns a new instance of Backtrace.



21
22
23
# File 'lib/failbot/backtrace.rb', line 21

def initialize(frames)
  @frames = frames
end

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



9
10
11
# File 'lib/failbot/backtrace.rb', line 9

def frames
  @frames
end

Class Method Details

.parse(backtrace) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/failbot/backtrace.rb', line 11

def self.parse(backtrace)
  fail ArgumentError, "expected Array, got #{backtrace.class}" unless backtrace.is_a?(Array)

  frames = backtrace.map do |frame|
    Frame.parse(frame)
  end

  new(frames)
end