mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
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.
This commit is contained in:
parent
6c083f12c7
commit
0cb9a49705
2 changed files with 5 additions and 0 deletions
|
@ -55,6 +55,10 @@ class Pry
|
|||
# @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
|
||||
|
||||
|
|
|
@ -446,6 +446,7 @@ class Pry
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue