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

Function formatCompilerError

pkg/workflow/compiler_error_formatter.go:34–50  ·  view source on GitHub ↗

formatCompilerError creates a formatted compiler error at line 1, column 1. Use this when the exact source position is unknown; IDE tooling can still navigate to the file. Use formatCompilerErrorWithPosition when a specific line/column is available. When cause is a *WorkflowValidationError with Line

(filePath string, errType string, message string, cause error)

Source from the content-addressed store, hash-verified

32// message: the error message text
33// cause: optional underlying error to wrap (use nil for validation errors)
34func formatCompilerError(filePath string, errType string, message string, cause error) error {
35 line, column := 1, 1
36 // Promote precise source location from WorkflowValidationError when available so that
37 // the emitted "file:line:col: error:" prefix points directly at the problematic field
38 // rather than always defaulting to line 1, column 1.
39 var vErr *WorkflowValidationError
40 if errors.As(cause, &vErr) && vErr.Line > 0 {
41 line = vErr.Line
42 if vErr.Column > 0 {
43 column = vErr.Column
44 }
45 if vErr.File != "" {
46 filePath = vErr.File
47 }
48 }
49 return formatCompilerErrorWithPosition(filePath, line, column, errType, message, cause)
50}
51
52// isFormattedCompilerError reports whether err is already a console-formatted compiler error
53// produced by formatCompilerError, formatCompilerErrorWithPosition, or parser.FormatImportError.

Callers 15

validatePermissionsMethod · 0.85
validateModelAliasMapMethod · 0.85
validateAliasKeyFunction · 0.85
validateAgentFileMethod · 0.85
validateRunsOnFunction · 0.85
validateExpressionsMethod · 0.85
validateFeatureConfigMethod · 0.85

Calls 1