Skip to content

Commit

Permalink
log on warn and log+exit on error
Browse files Browse the repository at this point in the history
  • Loading branch information
ath0mas committed Mar 26, 2021
1 parent 721e35f commit 78b08c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ function remove(root, done) {
if (path.basename(dir.fullPath) === 'node_modules') {
dirs.push(dir.fullPath);
}
}).once('end', function() {
}).on('warn', function(err) {
console.warn('Non-fatal error:', err.message);
}).on('error', function(err) {
console.error('Fatal error:', err);
done(err);
}).on('end', function() {
map(dirs, 1, function(dirname, next) {
if (fs.existsSync(dirname)) {
rimraf(dirname, next);
Expand Down

0 comments on commit 78b08c7

Please sign in to comment.