Module: Pry::ExceptionHandler Private

Defined in:
lib/pry/exception_handler.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0

Class Method Summary collapse

Class Method Details

.handle_exception(output, exception, _pry_instance) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Will only show the first line of the backtrace.

Since:

  • v0.13.0



9
10
11
12
13
14
15
# File 'lib/pry/exception_handler.rb', line 9

def handle_exception(output, exception, _pry_instance)
  if exception.is_a?(UserError) && exception.is_a?(SyntaxError)
    output.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')}"
  else
    output.puts standard_error_text_for(exception)
  end
end