Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,57 @@
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
module Console
module Terminal
module Formatter
class Failure
KEY = :failure
def initialize(terminal)
@terminal = terminal
@terminal[:exception_title] ||= @terminal.style(:red, nil, :bold)
@terminal[:exception_detail] ||= @terminal.style(:yellow)
@terminal[:exception_backtrace] ||= @terminal.style(:red)
@terminal[:exception_backtrace_other] ||= @terminal.style(:red, nil, :faint)
@terminal[:exception_message] ||= @terminal.style(:default)
end
def format(event, output, prefix: nil, verbose: false, width: 80)
title = event[:class]
message = event[:message]
backtrace = event[:backtrace]
root = event[:root]
lines = message.lines.map(&:chomp)
output.puts " #{prefix}#{@terminal[:exception_title]}#{title}#{@terminal.reset}: #{lines.shift}"
lines.each do |line|
output.puts " #{@terminal[:exception_detail]}#{line}#{@terminal.reset}"
end
root_pattern = /^#{root}\// if root
backtrace&.each_with_index do |line, index|
path, offset, message = line.split(":", 3)
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 cause = event[:cause]
format(cause, output, prefix: "Caused by ", verbose: verbose, width: width)
end
end
end
end
end
end