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)
| 149 | // |
| 150 | // Returns the one-line summary string. |
| 151 | func 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 |
no outgoing calls