don't print traceback on syntax error in CLI
This commit is contained in:
parent
aac7aac373
commit
2cedc843a8
@ -20,7 +20,17 @@ exports.transform = function (filename, code, opts) {
|
||||
opts = _.extend(opts || {}, index.opts);
|
||||
opts.filename = filename;
|
||||
|
||||
var result = to5.transform(code, opts);
|
||||
var result;
|
||||
try {
|
||||
result = to5.transform(code, opts);
|
||||
} catch(e) {
|
||||
if (e.name === "SyntaxError") {
|
||||
console.error("SyntaxError:", e.message);
|
||||
process.exit(1);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
result.filename = filename;
|
||||
result.actual = code;
|
||||
return result;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user