MCPcopy Create free account
hub / github.com/andywer/postguard / augmentFileValidationError

Function augmentFileValidationError

src/errors.ts:90–111  ·  view source on GitHub ↗
(
  error: Error | CodeError | ValidationError,
  query: Query
)

Source from the content-addressed store, hash-verified

88}
89
90export function augmentFileValidationError(
91 error: Error | CodeError | ValidationError,
92 query: Query
93) {
94 const location =
95 "location" in error && error.location
96 ? error.location
97 : getOverallSourceLocation(query.sourceMap.map(span => span.sourceLocation))
98
99 const formattedQuery = codeFrameColumns(query.sourceFile.fileContent, location)
100
101 error.name = "ValidationError"
102 error.message =
103 format.error(
104 `Query validation failed in ${formatSourceLink(query.sourceFile.filePath, location)}:`
105 ) +
106 `\n\n` +
107 format.error(`${error.message}`) +
108 `\n\n` +
109 formattedQuery
110 return error
111}
112
113export function augmentQuerySyntaxError(
114 error: Error,

Callers 3

validateSubqueryFunction · 0.90
validateQueryInvocationFunction · 0.90
parsePostgresQueryFunction · 0.90

Calls 2

getOverallSourceLocationFunction · 0.85
formatSourceLinkFunction · 0.85

Tested by

no test coverage detected