Sha256: c26b68048d04025ab72acb30f6ed83112233b2b39b6748b4addc670880d62801

Contents?: true

Size: 920 Bytes

Versions: 10

Compression:

Stored size: 920 Bytes

Contents

require 'byebug/setting'

module Byebug
  #
  # Setting to enable/disable post_mortem mode, i.e., a debugger prompt after
  # program termination by unhandled exception.
  #
  class PostMortemSetting < Setting
    def initialize
      Byebug.post_mortem = DEFAULT
    end

    def banner
      'Enable/disable post-mortem mode'
    end

    def value=(v)
      Byebug.post_mortem = v
    end

    def value
      Byebug.post_mortem?
    end
  end

  #
  # Saves information about the unhandled exception and gives a byebug
  # prompt back to the user before program termination.
  #
  def self.handle_post_mortem
    return unless Byebug.raised_exception

    context = Byebug.raised_exception.__bb_context
    file = Byebug.raised_exception.__bb_file
    line = Byebug.raised_exception.__bb_line

    Byebug.handler.at_line(context, file, line)
  end

  at_exit { Byebug.handle_post_mortem if Byebug.post_mortem? }
end

Version data entries

10 entries across 9 versions & 3 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/byebug-4.0.5/lib/byebug/settings/post_mortem.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/byebug-4.0.5/lib/byebug/settings/post_mortem.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/settings/post_mortem.rb
byebug-5.0.0 lib/byebug/settings/post_mortem.rb
byebug-4.0.5 lib/byebug/settings/post_mortem.rb
byebug-4.0.4 lib/byebug/settings/post_mortem.rb
byebug-4.0.3 lib/byebug/settings/post_mortem.rb
byebug-4.0.2 lib/byebug/settings/post_mortem.rb
byebug-4.0.1 lib/byebug/settings/post_mortem.rb
byebug-4.0.0 lib/byebug/settings/post_mortem.rb