class Sentry::StacktraceBuilder
def build(backtrace:, &frame_callback)
-
(StacktraceInterface)-
Other tags:
- Yieldparam: frame -
Parameters:
-
frame_callback(Proc) -- -
backtrace(Array) --
def build(backtrace:, &frame_callback) parsed_lines = parse_backtrace_lines(backtrace).select(&:file) frames = parsed_lines.reverse.map do |line| frame = convert_parsed_line_into_frame(line) frame = frame_callback.call(frame) if frame_callback frame end.compact StacktraceInterface.new(frames: frames) end
def convert_parsed_line_into_frame(line)
def convert_parsed_line_into_frame(line) frame = StacktraceInterface::Frame.new(project_root, line, strip_backtrace_load_path) frame.set_context(linecache, context_lines) if context_lines frame end
def initialize(
- See: Configuration#strip_backtrace_load_path -
See: Configuration#backtrace_cleanup_callback -
See: Configuration#context_lines -
See: Configuration#linecache -
See: Configuration#app_dirs_pattern -
See: Configuration#project_root -
Parameters:
-
strip_backtrace_load_path(Boolean) -- -
backtrace_cleanup_callback(Proc, nil) -- -
context_lines(Integer, nil) -- -
linecache(LineCache) -- -
app_dirs_pattern(Regexp, nil) -- -
project_root(String) --
def initialize( project_root:, app_dirs_pattern:, linecache:, context_lines:, backtrace_cleanup_callback: nil, strip_backtrace_load_path: true ) @project_root = project_root @app_dirs_pattern = app_dirs_pattern @linecache = linecache @context_lines = context_lines @backtrace_cleanup_callback = backtrace_cleanup_callback @strip_backtrace_load_path = strip_backtrace_load_path end
def parse_backtrace_lines(backtrace)
def parse_backtrace_lines(backtrace) Backtrace.parse( backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_callback ).lines end