Skip to content

Instantly share code, notes, and snippets.

@didoo
Created October 21, 2018 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save didoo/2b681bee9e5f1a6a4327d6278e35fa09 to your computer and use it in GitHub Desktop.
Save didoo/2b681bee9e5f1a6a4327d6278e35fa09 to your computer and use it in GitHub Desktop.
groupErrors.js suggestion
var chalk = require('chalk');
var groupedErrors = {};
var GroupErrors = {
GROUP: {
PropertyReferenceErrors: 'Property Reference Errors',
PropertyValueCollisions: 'Property Value Collisions',
},
flush: function (errorGroup, chalkType) {
chalkType = chalkType || chalk.bold.red;
if(errorGroup && groupedErrors[errorGroup] && groupedErrors[errorGroup].length) {
console.error(chalkType('\n' + errorGroup + ':\n'));
groupedErrors[errorGroup].forEach(function(err) {
console.error(chalkType(err.message || err));
})
delete groupedErrors[errorGroup];
console.error('\n\n');
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment