Method: PryExceptionExplorer.enter_exception

Defined in:
lib/pry-exception_explorer.rb

.enter_exception(ex, options = {}) ⇒ Object

Enter the exception context.

Parameters:

  • ex (Exception)

    The exception.

  • options (Hash) (defaults to: {})

    The optional configuration parameters.

Options Hash (options):

  • :inline (Boolean)

    Whether the exception is being entered inline (i.e within the raise method itself)



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/pry-exception_explorer.rb', line 208

def enter_exception(ex, options={})
  hooks = Pry.config.hooks.dup
  hooks.delete_hook(:before_session, :default)
  hooks.add_hook(:before_session, :set_exception_flag) do |_, _, _pry_|
    setup_exception_context(ex, _pry_, options)
  end.add_hook(:before_session, :manage_intercept_recurse) do
    PryExceptionExplorer.intercept_object.disable! if PryExceptionExplorer.inline? && !PryExceptionExplorer.intercept_object.intercept_recurse?
  end.add_hook(:after_session, :manage_intercept_recurse) do
    PryExceptionExplorer.intercept_object.enable! if !PryExceptionExplorer.intercept_object.active?
  end.add_hook(:before_session, :display_exception) do |_, _, _pry_|
    _pry_.run_command "cat --ex"
  end
  
  Pry.start binding, :call_stack => ex.exception_call_stack, :hooks => hooks
end