* 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[])
| 209 | * @param errors The list of parsing errors. |
| 210 | */ |
| 211 | function 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. |
no outgoing calls
no test coverage detected