Skip to content

Commit

Permalink
fix(cli): report gulpfile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tlancina committed Mar 28, 2016
1 parent 984f46f commit 9c53ffc
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,20 @@ function loadGulpfile(){
require(path.resolve(process.cwd() + '/' + names[i]));
return true;
} catch(e){
if (e instanceof SyntaxError) {
console.error('\nThere is a syntax error in your gulpfile:');
console.error(e.message)
process.exit(1);
}
if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(names[i]) === -1) {
console.log('Uh oh! Looks like you\'re missing a module in your gulpfile:');
console.error(e.message);
console.log('\nDo you need to run `npm install`?\n');
process.exit(1);
if (e.code === 'MODULE_NOT_FOUND') {
if (e.message.indexOf(names[i]) === -1) {
console.log('Uh oh! Looks like you\'re missing a module in your gulpfile:');
console.error(e.message);
console.log('\nDo you need to run `npm install`?\n');
process.exit(1);
} else {
// ignore missing gulpfile
continue
}
}
console.error('There is an error in your gulpfile: ')
console.error(e.stack);
process.exit(1);
}
}
return false;
Expand Down

0 comments on commit 9c53ffc

Please sign in to comment.