Skip to content

Instantly share code, notes, and snippets.

@didoo

didoo/groupErrors.js

Created Oct 21, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.