Add location information to parsing errors (#7314)

This commit is contained in:
Kai Cataldo
2018-02-04 14:00:03 -05:00
committed by Brian Ng
parent 5ea1bfe780
commit 7234442fde
3 changed files with 3 additions and 6 deletions

View File

@@ -148,8 +148,8 @@ function parseWithCodeFrame(code: string, parserOpts: {}): BabelNodeFile {
} catch (err) {
const loc = err.loc;
if (loc) {
err.loc = null;
err.message += "\n" + codeFrameColumns(code, { start: loc });
err.code = "BABEL_TEMPLATE_PARSE_ERROR";
}
throw err;
}