Skip to content

Commit

Permalink
Improved error message and added inline troubleshooting tips. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Feb 3, 2016
1 parent b0f1217 commit 957defd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/hooks/grunt/index.js
Expand Up @@ -200,7 +200,10 @@ module.exports = function(sails) {

} // </console message contains "Fatal error">

// Handle fatal Grunt errors by killing Sails process as well
// Handle fatal Grunt errors by killing Sails process as well:
////////////////////////////////////////////////////////////////////
//
// "Aborted due to warnings"
else if (consoleMsg.match(/Aborted due to warnings/)) {
sails.log.error('** Grunt :: An error occurred. **');
// sails.log.warn(trimmedStackTrace);
Expand All @@ -209,12 +212,28 @@ module.exports = function(sails) {
return;
} // </console message contains "Aborted due to warnings">

// "Warning: EMFILE"
else if (consoleMsg.match(/Warning: EMFILE/)){
sails.log.error('** Grunt :: An EMFILE error occurred. **');
sails.log.error(
'Usually this means there are too many files open as per your system settings.\n'+
'If you are developing on one of the many unix-based operating systems that has\n'+
'the `ulimit` command, then you might try running: `ulimit -n 1024`. For more tips,\n'+
'see https://github.com/balderdashy/sails/issues/3523#issuecomment-175922746.\n'+
'(command[⌘]+double-click to open links in the terminal)'
);
Err.fatal.__GruntAborted__(trimmedConsoleMsg, trimmedStackTrace);
return;
} // </console message contains "Warning: EMFILE">

// "ParseError"
else if (consoleMsg.match(/ParseError/)) {
sails.log.warn('** Grunt :: Parse Warning **');
sails.log.warn(trimmedStackTrace);
} // </console message contains "ParseError">

// Only display console message if it has content besides whitespace
//////////////////////////////////////////////////////////////////
else if (!consoleMsg.match(/^\s*$/)) {
sails.log.verbose('Grunt :: ' + trimmedConsoleMsg);
} // </console message has content which is not whitespace>
Expand Down

0 comments on commit 957defd

Please sign in to comment.