diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-04-14 19:14:16 +0300 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2019-04-15 00:08:24 +0300 |
commit | 95d3a74e9b22c44ea48ce870171640f0471db09b (patch) | |
tree | 5dae8107c718d96c11a0340d7b3c55a550fab0d0 /lib/pry/config.rb | |
parent | 9306e69bda2f44985944cbc162db4723cb8a0ec4 (diff) | |
download | pry-exception-handler-refactoring.tar.gz |
config: factor out exception_handler hook to a separate classexception-handler-refactoring
Diffstat (limited to 'lib/pry/config.rb')
-rw-r--r-- | lib/pry/config.rb | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/lib/pry/config.rb b/lib/pry/config.rb index 6b7e4fcf..6fcf9920 100644 --- a/lib/pry/config.rb +++ b/lib/pry/config.rb @@ -7,7 +7,6 @@ class Pry # @return [Pry::Config] # An object who implements the default configuration for all # Pry sessions. - # rubocop:disable Metrics/AbcSize def self.defaults defaults = from_hash( input: Pry.lazy { lazy_readline(defaults) }, @@ -18,26 +17,7 @@ class Pry prompt_safe_contexts: Pry::Prompt::SAFE_CONTEXTS, print: Pry::ColorPrinter.method(:default), quiet: false, - - # Will only show the first line of the backtrace - exception_handler: proc do |output, exception, _| - if exception.is_a?(UserError) && exception.is_a?(SyntaxError) - output.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')}" - else - output.puts "#{exception.class}: #{exception.message}" - output.puts "from #{exception.backtrace.first}" - - if exception.respond_to? :cause - cause = exception.cause - while cause - output.puts "Caused by #{cause.class}: #{cause}\n" - output.puts "from #{cause.backtrace.first}" - cause = cause.cause - end - end - end - end, - + exception_handler: Pry::ExceptionHandler.method(:handle_exception), unrescued_exceptions: [ ::SystemExit, ::SignalException, Pry::TooSafeException ], @@ -113,7 +93,6 @@ class Pry exec_string: "" ) end - # rubocop:enable Metrics/AbcSize def self.shortcuts Convenience::SHORTCUTS |