MCPcopy Create free account
hub / github.com/dataform-co/dataform / formatStackTraceForQuietCompilation

Function formatStackTraceForQuietCompilation

cli/console.ts:240–254  ·  view source on GitHub ↗
(compileError: dataform.ICompilationError)

Source from the content-addressed store, hash-verified

238}
239
240function formatStackTraceForQuietCompilation(compileError: dataform.ICompilationError): string {
241 // Show only first 3 or available lines for cleaner error output
242 // which contains the information on the file where the error occurred and the sufficient metadata for the user to fix the error. For e.g.
243 // (line: 1) Unexpected identifier <file_path>: <line_number>
244 // (line: 2) tags: ["<tag_name>"]
245 // (line: 3) ^^^^
246 if (compileError?.message?.includes("Unexpected identifier")) {
247 if (!compileError.stack) {
248 return "";
249 }
250 const stackLines = compileError.stack?.split("\n") || [];
251 return stackLines.slice(0, Math.min(3, stackLines.length)).join("\n");
252 }
253 return "";
254}
255
256export function printCompiledGraphErrors(graphErrors: dataform.IGraphErrors, quietCompilation: boolean) {
257 if (graphErrors.compilationErrors && graphErrors.compilationErrors.length > 0) {

Callers 1

printCompiledGraphErrorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected