class Console::Event::Failure

def format_exception(exception, prefix, output, terminal, verbose)

def format_exception(exception, prefix, output, terminal, verbose)
	lines = exception.message.lines.map(&:chomp)
	
	output.puts "  #{prefix}#{terminal[:exception_title]}#{exception.class}#{terminal.reset}: #{lines.shift}"
	
	lines.each do |line|
		output.puts "  #{terminal[:exception_detail]}#{line}#{terminal.reset}"
	end
	
	root_pattern = /^#{@root}\// if @root
	
	exception.backtrace&.each_with_index do |line, index|
		path, offset, message = line.split(":")
		style = :exception_backtrace
		
		# Make the path a bit more readable
		if root_pattern and path.sub!(root_pattern, "").nil?
			style = :exception_backtrace_other
		end
		
		output.puts "  #{index == 0 ? "→" : " "} #{terminal[style]}#{path}:#{offset}#{terminal[:exception_message]} #{message}#{terminal.reset}"
	end
	
	if exception.cause
		format_exception(exception.cause, "Caused by ", output, terminal, verbose)
	end
end