Comparing version 0.7.16 to 0.8.1
@@ -60,6 +60,14 @@ /* | ||
// Wrap error with task name and possibly other diagnostics | ||
function doneWrap(err, res) { | ||
if (err) { | ||
err = {task: name, error: err}; | ||
} | ||
done(err, res); | ||
} | ||
switch (type) { | ||
case 'append': // Concats new blobs to existing queue | ||
async.map(arrayize(options), task.bind(this), function(err, results) { | ||
done(err, blobs.concat(results)); | ||
doneWrap(err, blobs.concat(results)); | ||
}); | ||
@@ -69,3 +77,3 @@ break; | ||
case 'collect': // Task can inspect entire queue | ||
task.call(this, options, blobs, done); | ||
task.call(this, options, blobs, doneWrap); | ||
break; | ||
@@ -76,3 +84,3 @@ | ||
task.call(this, arr[0], arr[1], cb); | ||
}).bind(this), done); | ||
}).bind(this), doneWrap); | ||
break; | ||
@@ -82,3 +90,3 @@ | ||
async.forEach(blobs, task.bind(this, options), function(err) { | ||
done(err, blobs); | ||
doneWrap(err, blobs); | ||
}); | ||
@@ -88,3 +96,3 @@ break; | ||
case 'map': // Task transforms one blob at a time | ||
async.map(blobs, task.bind(this, options), done); | ||
async.map(blobs, task.bind(this, options), doneWrap); | ||
break; | ||
@@ -94,3 +102,3 @@ | ||
async.reduce(blobs, new Blob(), task.bind(this, options), function(err, results) { | ||
done(err, [results]); | ||
doneWrap(err, [results]); | ||
}); | ||
@@ -97,0 +105,0 @@ break; |
{ | ||
"name": "gear", | ||
"version": "0.7.16", | ||
"version": "0.8.1", | ||
"description": "Gear.js - Build System for Node.js and the Browser", | ||
@@ -5,0 +5,0 @@ "author": "Stephen Murphy <stephen@hypernaut.com>", |
@@ -59,3 +59,3 @@ var should = require('should'), | ||
.run(function(err, results) { | ||
err.should.equal(fixtures.sentinel); | ||
err.error.should.equal(fixtures.sentinel); | ||
done(); | ||
@@ -62,0 +62,0 @@ }); |
555818
2601