add error name to babel-cli syntax errors

This commit is contained in:
Sebastian McKenzie 2015-07-31 12:48:52 +01:00
parent 2d73acdd54
commit c4e43bdeea

View File

@ -57,11 +57,11 @@ exports.compile = function (filename, opts) {
function toErrorStack(err) {
if (err._babel && err instanceof SyntaxError) {
return err.message + "\n" + err.codeFrame;
return `${err.name}: ${err.message}\n${err.codeFrame}`;
} else {
return err.stack;
}
};
}
process.on("uncaughtException", function (err) {
console.error(toErrorStack(err));