Skip to content

Commit

Permalink
Use mkdirp and a bit cleaner error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
robrich committed Nov 11, 2013
1 parent 416aae4 commit 82e4398
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ function Gulp(){
gulp.log('Finished', "'"+chalk.cyan(e.task)+"'");
});
this.on('task_err', function(e){
var mess = e && e.message ? e.message : e;
var mess;
if (e.err) {
if (e.err.message) {
mess = e.err.message;
} else {
mess = JSON.stringify(e.err);
}
} else {
mess = e.message;
}
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' "+chalk.red(mess)+' ');
});
}
Expand Down
7 changes: 2 additions & 5 deletions lib/writeDir.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
var fs = require('fs');
var mkdirp = require('mkdirp');
var isStream = require('./isStream');

module.exports = function (writePath, file, cb) {
// create directory
fs.mkdir(writePath, function (err) {
if (err && err.code === 'EEXIST') {
err = null; // Ignore 'directory already exists' error
}
mkdirp(writePath, function (err) {
if (err) {
cb(err);
}
Expand Down

0 comments on commit 82e4398

Please sign in to comment.