MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / formatError

Function formatError

scripts/lint-mermaid/lint-mermaid.mjs:126–133  ·  view source on GitHub ↗
(err, file, block)

Source from the content-addressed store, hash-verified

124}
125
126function formatError(err, file, block) {
127 const msg = err?.message || String(err);
128 const match = msg.match(/Parse error on line (\d+)/i);
129 const relLine = match ? parseInt(match[1], 10) : 1;
130 const sourceLine = block.startLine + relLine;
131 const head = msg.split('\n').slice(0, 6).join('\n ');
132 return `${file}:${sourceLine}: mermaid parse error\n ${head}`;
133}
134
135async function lintFile(file) {
136 const text = await readFile(file, 'utf8');

Callers 1

lintFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected