Comparing version 0.0.1 to 0.0.2
0.0.1 / 2013-01-15 | ||
0.0.2 / 2014-02-20 | ||
================== | ||
* fix infinite loop | ||
0.0.1 / 2014-01-15 | ||
================== | ||
* fix error bubbling | ||
0.0.0 / 2013-01-13 | ||
0.0.0 / 2014-01-13 | ||
================== | ||
* initial release |
@@ -52,3 +52,3 @@ | ||
if (next) stream.pipe(next); | ||
stream.on('error', ret.emit.bind(ret, 'error')); | ||
if (stream != ret) stream.on('error', ret.emit.bind(ret, 'error')); | ||
}); | ||
@@ -55,0 +55,0 @@ |
{ | ||
"name": "multipipe", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "pipe streams with centralized error handling", | ||
@@ -15,2 +15,2 @@ "repository": "segmentio/multipipe", | ||
} | ||
} | ||
} |
@@ -38,21 +38,44 @@ var assert = require('assert'); | ||
}); | ||
it('should aggregate errors', function(done){ | ||
var a = Transform(); | ||
var b = Transform(); | ||
var c = Transform(); | ||
var stream = pipe(a, b, c); | ||
var err = new Error; | ||
var i = 0; | ||
stream.on('error', function(_err){ | ||
i++; | ||
assert.equal(_err, err); | ||
assert(i <= 3); | ||
if (i == 3) done(); | ||
describe('errors', function(){ | ||
it('should reemit', function(done){ | ||
var a = Transform(); | ||
var b = Transform(); | ||
var c = Transform(); | ||
var stream = pipe(a, b, c); | ||
var err = new Error; | ||
var i = 0; | ||
stream.on('error', function(_err){ | ||
i++; | ||
assert.equal(_err, err); | ||
assert(i <= 3); | ||
if (i == 3) done(); | ||
}); | ||
a.emit('error', err); | ||
b.emit('error', err); | ||
c.emit('error', err); | ||
}); | ||
a.emit('error', err); | ||
b.emit('error', err); | ||
c.emit('error', err); | ||
it('should not reemit endlessly', function(done){ | ||
var a = Transform(); | ||
var b = Transform(); | ||
var c = Transform(); | ||
c.readable = false; | ||
var stream = pipe(a, b, c); | ||
var err = new Error; | ||
var i = 0; | ||
stream.on('error', function(_err){ | ||
i++; | ||
assert.equal(_err, err); | ||
assert(i <= 3); | ||
if (i == 3) done(); | ||
}); | ||
a.emit('error', err); | ||
b.emit('error', err); | ||
c.emit('error', err); | ||
}); | ||
}); | ||
@@ -59,0 +82,0 @@ }); |
5532
137