Class: Sentry::StacktraceInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/interfaces/stacktrace.rb

Defined Under Namespace

Classes: Frame

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backtrace:, project_root:, app_dirs_pattern:, linecache:, context_lines:, backtrace_cleanup_callback: nil) ⇒ StacktraceInterface

Returns a new instance of StacktraceInterface.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sentry/interfaces/stacktrace.rb', line 5

def initialize(backtrace:, project_root:, app_dirs_pattern:, linecache:, context_lines:, backtrace_cleanup_callback: nil)
  @project_root = project_root
  @frames = []

  parsed_backtrace_lines = Backtrace.parse(
    backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback
  ).lines

  parsed_backtrace_lines.reverse.each_with_object(@frames) do |line, frames|
    frame = convert_parsed_line_into_frame(line, project_root, linecache, context_lines)
    frames << frame if frame.filename
  end
end

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



3
4
5
# File 'lib/sentry/interfaces/stacktrace.rb', line 3

def frames
  @frames
end

Instance Method Details

#to_hashObject



19
20
21
# File 'lib/sentry/interfaces/stacktrace.rb', line 19

def to_hash
  { frames: @frames.map(&:to_hash) }
end