Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add Pry.last_internal_error

This is set to the last CommandError, SlopError, etc. Most often
raised by commands. This info is useful to pry devs debugging
otherwise opaque command errors.
  • Loading branch information...
commit 0cb9a497050169c6de67da33291c606e5289685a 1 parent 6c083f1
@banister banister authored
Showing with 5 additions and 0 deletions.
  1. +4 −0 lib/pry/pry_class.rb
  2. +1 −0  lib/pry/pry_instance.rb
View
4 lib/pry/pry_class.rb
@@ -55,6 +55,10 @@ def self.delegate_accessors(delagatee, *names)
# @return [Binding] A top level binding with no local variables
attr_accessor :toplevel_binding
+ # @return [Exception, nil] The last pry internal error.
+ # (a CommandError in most cases)
+ attr_accessor :last_internal_error
+
# plugin forwardables
def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins
View
1  lib/pry/pry_instance.rb
@@ -446,6 +446,7 @@ def process_command(val)
def process_command_safely(val)
process_command(val)
rescue CommandError, Slop::InvalidOptionError, MethodSource::SourceNotFoundError => e
+ Pry.last_internal_error = e
output.puts "Error: #{e.message}"
true
end
Please sign in to comment.
Something went wrong with that request. Please try again.