Created
October 21, 2018 10:39
-
-
Save didoo/2b681bee9e5f1a6a4327d6278e35fa09 to your computer and use it in GitHub Desktop.
groupErrors.js suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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