MCPcopy Index your code
hub / github.com/angular/angular-cli / formatError

Function formatError

packages/angular/cli/src/utilities/json-file.ts:211–218  ·  view source on GitHub ↗

* Formats a JSON parsing error and throws an exception. * @param path The path to the file that failed to parse. * @param errors The list of parsing errors.

(path: string, errors: ParseError[])

Source from the content-addressed store, hash-verified

209 * @param errors The list of parsing errors.
210 */
211function formatError(path: string, errors: ParseError[]): never {
212 const { error, offset } = errors[0];
213 throw new Error(
214 `Failed to parse "${path}" as JSON AST Object. ${printParseErrorCode(
215 error,
216 )} at location: ${offset}.`,
217 );
218}
219
220/**
221 * Parses a JSON string, supporting comments and trailing commas.

Callers 2

JsonAstMethod · 0.85
readAndParseJsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected