Class: ExceptionTracer

Inherits:
Tracer::Base show all
Defined in:
lib/ruby_tracer/exception_tracer.rb

Constant Summary

Constants inherited from Tracer::Base

Tracer::Base::DIR, Tracer::Base::HOME, Tracer::Base::M_CLASS, Tracer::Base::M_INSPECT, Tracer::Base::M_IS_A, Tracer::Base::M_OBJECT_ID

Constants included from Tracer::Color

Tracer::Color::BLUE, Tracer::Color::BOLD, Tracer::Color::CLEAR, Tracer::Color::CYAN, Tracer::Color::GREEN, Tracer::Color::MAGENTA, Tracer::Color::RED, Tracer::Color::REVERSE, Tracer::Color::UNDERLINE, Tracer::Color::YELLOW

Instance Method Summary collapse

Methods inherited from Tracer::Base

#colorizable?, #description, #header, #initialize, #key, #minfo, #out, #pretty_path, #puts, #safe_inspect, #skip?, #skip_internal?, #start, #started?, #stop, #stopped?, #to_s

Methods included from Tracer::Color

clear, colorize, #colorize, #colorize_blue, #colorize_cyan, #colorize_magenta

Constructor Details

This class inherits a constructor from Tracer::Base

Instance Method Details

#setup_tpObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby_tracer/exception_tracer.rb', line 6

def setup_tp
  TracePoint.new(:raise) do |tp|
    next if skip?(tp)

    exc = tp.raised_exception

    out tp,
        " #{colorize_magenta(exc.inspect)}",
        depth: caller.size - (1 + @depth_offset)
  rescue Exception => e
    p e
  end
end

#skip_with_pattern?(tp) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ruby_tracer/exception_tracer.rb', line 20

def skip_with_pattern?(tp)
  super && !tp.raised_exception.inspect.match?(@pattern)
end