Comparing version 0.0.3 to 0.0.4
11
index.js
@@ -96,2 +96,3 @@ /* | ||
this._arguments = []; | ||
this._errors = []; | ||
this._controls = []; | ||
@@ -104,3 +105,11 @@ | ||
this._arguments[index] = data; | ||
if (!--this._length) this._continue.apply(this, [error].concat(this._arguments)); | ||
if (error) this._errors.push(error); | ||
if (!--this._length) { | ||
var errors = null; | ||
if (this._errors.length === 1) errors = this._errors[0]; | ||
else if (this._errors.length) errors = new Error(map(this._errors, function(e) { | ||
return e.message; | ||
}).join('\n')); | ||
this._continue.apply(this, [errors].concat(this._arguments)); | ||
} | ||
else this._controls[index]._kill(); | ||
@@ -107,0 +116,0 @@ } |
{ | ||
"name": "finally", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "sane flow control library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -168,2 +168,19 @@ "use strict" | ||
it('should get errors when parallels return errors', function() { | ||
flow(function(err) { | ||
this.done(new Error('A')); | ||
}, function(err) { | ||
this.done(new Error('B')); | ||
}, function(err) { | ||
this.done(null, true) | ||
}).finally(function(error, vA, vB, vC) { | ||
expect(error.message).to.be('A\nB') | ||
expect(vA).to.be(undefined) | ||
expect(vB).to.be(undefined) | ||
expect(vC).to.be(true) | ||
}) | ||
}) | ||
}) | ||
@@ -170,0 +187,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16648
404