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

Function formatCompilerErrorWithContext

pkg/workflow/compiler_error_formatter.go:102–116  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
102func 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)

Callers 2

Calls 2

FormatErrorFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected