@@ -4,6 +4,16 @@ import (
44 "fmt"
55 "strings"
66 "time"
7+
8+ "github.com/charmbracelet/lipgloss"
9+ )
10+
11+ var (
12+ errorTitleStyle = lipgloss .NewStyle ().Bold (true ).Foreground (lipgloss .Color ("#C33820" ))
13+ errorSecondaryStyle = lipgloss .NewStyle ().Foreground (lipgloss .Color ("241" ))
14+ errorActionStyle = lipgloss .NewStyle ().Foreground (lipgloss .Color ("69" ))
15+ errorValueStyle = lipgloss .NewStyle ().Bold (true )
16+ errorMutedStyle = lipgloss .NewStyle ().Foreground (lipgloss .Color ("245" ))
717)
818
919// FormatEventLine converts an output event into a single display line.
@@ -130,21 +140,27 @@ func formatMessageEvent(e MessageEvent) string {
130140
131141func formatErrorEvent (e ErrorEvent ) string {
132142 var sb strings.Builder
133- sb .WriteString ("Error: " )
134- sb .WriteString (e .Title )
143+ sb .WriteString (errorTitleStyle .Render ("✗ " + e .Title ))
135144 if e .Summary != "" {
136- sb .WriteString ("\n " )
145+ sb .WriteString ("\n " )
146+ sb .WriteString (errorSecondaryStyle .Render ("> " ))
137147 sb .WriteString (e .Summary )
138148 }
139149 if e .Detail != "" {
140150 sb .WriteString ("\n " )
141- sb .WriteString (e .Detail )
151+ sb .WriteString (errorMutedStyle . Render ( e .Detail ) )
142152 }
143- for _ , action := range e .Actions {
144- sb .WriteString ("\n " + ErrorActionPrefix )
145- sb .WriteString (action .Label )
146- sb .WriteString (" " )
147- sb .WriteString (action .Value )
153+ if len (e .Actions ) > 0 {
154+ sb .WriteString ("\n " )
155+ for i , action := range e .Actions {
156+ sb .WriteString ("\n " )
157+ if i > 0 {
158+ sb .WriteString (errorMutedStyle .Render (ErrorActionPrefix + action .Label + " " + action .Value ))
159+ } else {
160+ sb .WriteString (errorActionStyle .Render (ErrorActionPrefix + action .Label + " " ))
161+ sb .WriteString (errorValueStyle .Render (action .Value ))
162+ }
163+ }
148164 }
149165 return sb .String ()
150166}
0 commit comments