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

@@ -91,7 +91,6 @@ function parser(pluginPasses, options, code) {
} catch (err) {
const { loc, missingPlugin } = err;
if (loc) {
err.loc = null;
const codeFrame = codeFrameColumns(
code,
{
@@ -110,6 +109,7 @@ function parser(pluginPasses, options, code) {
err.message =
`${options.filename || "unknown"}: ${err.message}\n\n` + codeFrame;
}
err.code = "BABEL_PARSE_ERROR";
}
throw err;
}