Skip to content

Commit

Permalink
Fail build on error, and print a useful message (ampproject#13255)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored and protonate committed Feb 26, 2018
1 parent 0975b0a commit 45f51d0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,10 @@ function compileJs(srcDir, srcFilename, destDir, options) {
const startTime = Date.now();
return toPromise(bundler.bundle()
.on('error', function(err) {
if (err instanceof SyntaxError) {
console.error(red('Syntax error: ' + err.message));
} else {
console.error(red(err.message));
}
// Drop the node_modules call stack, which begins with ' at'.
const message = err.stack.replace(/ at[^]*/, '').trim();
console.error(red(message));
process.exit(1);
})
.pipe(lazybuild())
.pipe($$.rename(destFilename))
Expand Down

0 comments on commit 45f51d0

Please sign in to comment.