Sha256: 8e02966d68ffbe9660760e6f3447b0c0e799c49f74ad61df29d6ff2901215fdb

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

module Debugger
  class CatchCommand < Command # :nodoc:
    self.control = true

    def regexp
      /^\s* cat(?:ch)? (?:\s+(.+))? $/x
    end

    def execute
      excn = @match[1]
      unless excn
        errmsg "Exception class must be specified for 'catch' command"
      else
        binding = @state.context ? get_binding : TOPLEVEL_BINDING
        unless debug_eval("#{excn}.is_a?(Class)", binding)
          print_msg "Warning #{excn} is not known to be a Class"
        end
        Debugger.add_catchpoint(excn)
        print_msg "Set catchpoint %s.", excn
      end
    end

    class << self
      def help_command
        'catch'
      end

      def help(cmd)
        %{
          cat[ch]\t\t\tshow catchpoint
          cat[ch] <an Exception>\tset catchpoint to an exception
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-debug-ide-0.2.0 lib/ruby-debug/commands/catchpoint.rb
ruby-debug-ide-0.2.1 lib/ruby-debug/commands/catchpoint.rb