mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
minor refactor to wtf command
This commit is contained in:
parent
a1a6306ce2
commit
a42eec8853
1 changed files with 7 additions and 3 deletions
|
@ -26,9 +26,9 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
def process
|
def process
|
||||||
raise Pry::CommandError, "No most-recent exception" unless _pry_.last_exception
|
raise Pry::CommandError, "No most-recent exception" unless exception
|
||||||
|
|
||||||
output.puts "#{text.bold('Exception:')} #{_pry_.last_exception.class}: #{_pry_.last_exception}\n--"
|
output.puts "#{text.bold('Exception:')} #{exception.class}: #{exception}\n--"
|
||||||
if opts.verbose?
|
if opts.verbose?
|
||||||
output.puts with_line_numbers(backtrace)
|
output.puts with_line_numbers(backtrace)
|
||||||
else
|
else
|
||||||
|
@ -38,12 +38,16 @@ class Pry
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def exception
|
||||||
|
_pry_.last_exception
|
||||||
|
end
|
||||||
|
|
||||||
def with_line_numbers(bt)
|
def with_line_numbers(bt)
|
||||||
Pry::Code.new(bt, 0, :text).with_line_numbers.to_s
|
Pry::Code.new(bt, 0, :text).with_line_numbers.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def backtrace
|
def backtrace
|
||||||
_pry_.last_exception.backtrace
|
exception.backtrace
|
||||||
end
|
end
|
||||||
|
|
||||||
def size_of_backtrace
|
def size_of_backtrace
|
||||||
|
|
Loading…
Reference in a new issue