[Pkg-javascript-commits] [node-stream-combiner2] 27/41: re-emit error object for old streams
Bastien Roucariès
rouca at moszumanska.debian.org
Wed Sep 6 09:57:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-combiner2.
commit fa4f832ed04dd710ff9a2cbd0f222766d99ced4b
Author: Alan Shaw <alan at freestyle-developments.co.uk>
Date: Mon Sep 29 16:43:04 2014 +0100
re-emit error object for old streams
---
index.js | 2 +-
test/index.js | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/index.js b/index.js
index 8f217fc..eb185d8 100644
--- a/index.js
+++ b/index.js
@@ -67,6 +67,6 @@ function wrap (tr, opts) {
var input = through(opts), output = through(opts)
input.pipe(tr).pipe(output)
var dup = duplexer(input, output)
- tr.on('error', function (err) { dup.emit('error') });
+ tr.on('error', function (err) { dup.emit('error', err) });
return dup;
}
diff --git a/test/index.js b/test/index.js
index 8bc1cd3..79ee38a 100644
--- a/test/index.js
+++ b/test/index.js
@@ -3,6 +3,24 @@ var through = require('through2')
var combine = require('..')
var test = require('tape')
+test('re-emit error object for old streams', function (test) {
+ test.plan(1)
+
+ var expectedErr = new Error('asplode')
+
+ var pipe = combine(
+ es.through(function(data) {
+ return this.emit('error', expectedErr)
+ })
+ )
+
+ pipe.on('error', function (err) {
+ test.equal(err, expectedErr)
+ })
+
+ pipe.write('pow')
+})
+
test('do not duplicate errors', function (test) {
var errors = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-combiner2.git
More information about the Pkg-javascript-commits
mailing list