class DEBUGGER__::CatchBreakpoint

Attributes

last_exc[R]

Public Class Methods

new(pat, cond: nil, command: nil, path: nil) click to toggle source
Calls superclass method DEBUGGER__::Breakpoint::new
# File debug-1.4.0/lib/debug/breakpoint.rb, line 275
def initialize pat, cond: nil, command: nil, path: nil
  @pat = pat.freeze
  @key = [:catch, @pat].freeze
  @last_exc = nil

  @cond = cond
  @command = command
  @path = path

  super()
end

Public Instance Methods

description() click to toggle source
# File debug-1.4.0/lib/debug/breakpoint.rb, line 311
def description
  "#{@last_exc.inspect} is raised."
end
setup() click to toggle source
# File debug-1.4.0/lib/debug/breakpoint.rb, line 287
def setup
  @tp = TracePoint.new(:raise){|tp|
    exc = tp.raised_exception
    next if SystemExit === exc
    next if skip_path?(tp.path)

    next if !safe_eval(tp.binding, @cond) if @cond
    should_suspend = false

    exc.class.ancestors.each{|cls|
      if @pat === cls.name
        should_suspend = true
        @last_exc = exc
        break
      end
    }
    suspend if should_suspend
  }
end
to_s() click to toggle source
# File debug-1.4.0/lib/debug/breakpoint.rb, line 307
def to_s
  "#{generate_label("Catch")} #{@pat.inspect}"
end