MCPcopy Create free account
hub / github.com/github/gh-aw / formatMultilineError

Function formatMultilineError

pkg/console/console.go:365–380  ·  view source on GitHub ↗

formatMultilineError formats a plain error message, indenting any newlines so that continuation lines are visually subordinate to the leading "✗" prefix.

(msg string)

Source from the content-addressed store, hash-verified

363// formatMultilineError formats a plain error message, indenting any newlines so that
364// continuation lines are visually subordinate to the leading "✗" prefix.
365func formatMultilineError(msg string) string {
366 if !strings.Contains(msg, "\n") {
367 return FormatErrorMessage(msg)
368 }
369 lines := strings.Split(msg, "\n")
370 var sb strings.Builder
371 sb.WriteString(applyStyle(styles.Error, "✗ "))
372 sb.WriteString(lines[0])
373 for _, line := range lines[1:] {
374 if line != "" {
375 sb.WriteString("\n ")
376 sb.WriteString(line)
377 }
378 }
379 return sb.String()
380}
381
382// FormatSectionHeader formats a section header with proper styling
383func FormatSectionHeader(header string) string {

Callers 1

FormatErrorChainFunction · 0.85

Calls 3

applyStyleFunction · 0.85
FormatErrorMessageFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected