formatCompilerErrorWithContext creates a formatted compiler error with specific line/column position and source-code context lines for Rust-style rendering. Use this when source context is available; otherwise use formatCompilerErrorWithPosition. filePath: the file path to include in the error line
(filePath string, line int, column int, errType string, message string, cause error, context []string)
| 100 | // cause: optional underlying error to wrap (use nil for validation errors) |
| 101 | // context: source code lines around the error for Rust-like snippet rendering |
| 102 | func formatCompilerErrorWithContext(filePath string, line int, column int, errType string, message string, cause error, context []string) error { |
| 103 | compilerErrorLog.Printf("Formatting compiler error with context: file=%s, line=%d, column=%d, type=%s, context=%d lines", filePath, line, column, errType, len(context)) |
| 104 | formattedErr := console.FormatError(console.CompilerError{ |
| 105 | Position: console.ErrorPosition{ |
| 106 | File: filePath, |
| 107 | Line: line, |
| 108 | Column: column, |
| 109 | }, |
| 110 | Type: errType, |
| 111 | Message: message, |
| 112 | Context: context, |
| 113 | }) |
| 114 | |
| 115 | return &wrappedCompilerError{formatted: formattedErr, cause: cause} |
| 116 | } |
| 117 | |
| 118 | // formatCompilerMessage creates a formatted compiler message string (for warnings printed to stderr) |
| 119 | // filePath: the file path to include in the message (typically markdownPath or lockFile) |
no test coverage detected