lib/console/event/failure.rb in console-1.10.1 vs lib/console/event/failure.rb in console-1.10.2
- old
+ new
@@ -64,15 +64,17 @@
lines.each do |line|
output.puts " #{terminal[:exception_detail]}#{line}#{terminal.reset}"
end
+ root_expr = /^#{@root}\// if @root
+
exception.backtrace&.each_with_index do |line, index|
path, offset, message = line.split(":")
# Make the path a bit more readable
- path.gsub!(/^#{@root}\//, "./") if @root
-
+ path.sub!(root_expr, "./") if root_expr
+
output.puts " #{index == 0 ? "→" : " "} #{terminal[:exception_backtrace]}#{path}:#{offset}#{terminal.reset} #{message}"
end
if exception.cause
format_exception(exception.cause, "Caused by ", output, terminal, verbose)