add error name to babel-cli syntax errors
This commit is contained in:
parent
2d73acdd54
commit
c4e43bdeea
@ -57,11 +57,11 @@ exports.compile = function (filename, opts) {
|
|||||||
|
|
||||||
function toErrorStack(err) {
|
function toErrorStack(err) {
|
||||||
if (err._babel && err instanceof SyntaxError) {
|
if (err._babel && err instanceof SyntaxError) {
|
||||||
return err.message + "\n" + err.codeFrame;
|
return `${err.name}: ${err.message}\n${err.codeFrame}`;
|
||||||
} else {
|
} else {
|
||||||
return err.stack;
|
return err.stack;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
process.on("uncaughtException", function (err) {
|
process.on("uncaughtException", function (err) {
|
||||||
console.error(toErrorStack(err));
|
console.error(toErrorStack(err));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user