MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / FormatErrorSummary

Function FormatErrorSummary

pkg/errors/formatter.go:151–160  ·  view source on GitHub ↗

FormatErrorSummary provides a concise one-line error summary suitable for structured logging and monitoring systems where a full context window would be too verbose. For *Error values the output format is: [E2001] unexpected token: COMMA at line 5, column 20 For other error types the output is "E

(err error)

Source from the content-addressed store, hash-verified

149//
150// Returns the one-line summary string.
151func FormatErrorSummary(err error) string {
152 if structErr, ok := err.(*Error); ok {
153 return fmt.Sprintf("[%s] %s at line %d, column %d",
154 structErr.Code,
155 structErr.Message,
156 structErr.Location.Line,
157 structErr.Location.Column)
158 }
159 return fmt.Sprintf("Error: %v", err)
160}
161
162// FormatErrorWithSuggestion creates and formats a structured error that includes a
163// manually provided hint. When suggestion is empty, the function falls back to

Callers 1

TestFormatErrorSummaryFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatErrorSummaryFunction · 0.68