Method: Sentry::Backtrace.parse

Defined in:
lib/sentry/backtrace.rb

.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sentry/backtrace.rb', line 13

def self.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback)
  ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)

  ruby_lines = backtrace_cleanup_callback.call(ruby_lines) if backtrace_cleanup_callback

  in_app_pattern ||= begin
    Regexp.new("^(#{project_root}/)?#{app_dirs_pattern}")
  end

  lines = ruby_lines.to_a.map do |unparsed_line|
    Line.parse(unparsed_line, in_app_pattern)
  end

  new(lines)
end