MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / formatError

Function formatError

test/utils.ts:311–329  ·  view source on GitHub ↗
(errors: ParsingDiagnostic[])

Source from the content-addressed store, hash-verified

309
310function formatError(errors: ParsingDiagnostic[]): Expression {
311 return [
312 'Error',
313 [
314 'String',
315 ...(errors.map((x) => {
316 // If we have an array as the last element, it's the trace. Remove it.
317 if (
318 Array.isArray(x.message) &&
319 Array.isArray(x.message[x.message.length - 1])
320 ) {
321 return x.message.slice(0, -1);
322 }
323
324 return x.message;
325 }) as Expression[]),
326 ],
327 ];
328}
329
330export function validEpsil(s: string): Expression | null {
331 const [value, errors] = parseEpsil(s);
332 if (errors && errors.length > 0) return formatError(errors);

Callers 2

validCortexFunction · 0.85
invalidCortexFunction · 0.85

Calls 2

mapMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected