Sha256: 06160574a48859d2e7c3a0ed869b58b4a712f3cd87e9e7582d7a15685e643581

Contents?: true

Size: 903 Bytes

Versions: 2

Compression:

Stored size: 903 Bytes

Contents

module Byebug
  #
  # Reopens the +info+ command to define the +catch+ subcommand
  #
  class InfoCommand < Command
    #
    # Information on exceptions that can be caught by the debugger
    #
    class CatchSubcommand < Command
      def regexp
        /^\s* c(?:atch)? (?:\s+ (.+))? \s*$/x
      end

      def execute
        return puts('No frame selected.') unless @state.context

        if Byebug.catchpoints && !Byebug.catchpoints.empty?
          Byebug.catchpoints.each do |exception, _hits|
            puts("#{exception}: #{exception.is_a?(Class)}")
          end
        else
          puts 'No exceptions set to be caught.'
        end
      end

      def short_description
        'Exceptions that can be caught in the current stack frame'
      end

      def description
        <<-EOD
          inf[o] c[atch]

          #{short_description}
        EOD
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/commands/info/catch.rb
byebug-5.0.0 lib/byebug/commands/info/catch.rb