Sha256: abbf5cafefb97f2ce27c65d6f1eb75b034abebc8d933a14a197086b2677d293a
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
module Rollbar class Notifier class TraceWithBindings # :nodoc: attr_reader :frames, :exception_frames def initialize reset end def reset @frames = [] @exception_frames = [] @exception_signature = nil end def enable reset trace_point.enable if defined?(TracePoint) end def disable trace_point.disable if defined?(TracePoint) end private def exception_signature(trace) # use the exception backtrace to detect reraised exception. trace.raised_exception.backtrace.first end def detect_reraise(trace) @exception_signature == exception_signature(trace) end def trace_point return unless defined?(TracePoint) @trace_point ||= TracePoint.new(:call, :return, :b_call, :b_return, :c_call, :c_return, :raise) do |tp| case tp.event when :call, :b_call, :c_call, :class frames.push frame(tp) when :return, :b_return, :c_return, :end frames.pop when :raise unless detect_reraise(tp) # ignore reraised exceptions # may be possible to optimize better than #dup @exception_frames = @frames.dup @exception_signature = exception_signature(tp) end end end end def frame(trace) { :binding => trace.binding, :defined_class => trace.defined_class, :method_id => trace.method_id, :path => trace.path, :lineno => trace.lineno } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rollbar-3.3.0 | lib/rollbar/notifier/trace_with_bindings.rb |