[Pkg-javascript-commits] [node-read-only-stream] 12/22: forward errors
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Aug 20 13:52:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-read-only-stream.
commit 7cc4cb217cdf1b07643dac7d0bd6ed7527b87f93
Author: Julian Gruber <julian at juliangruber.com>
Date: Mon Sep 22 10:48:39 2014 +0200
forward errors
---
index.js | 1 +
test/error.js | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/index.js b/index.js
index ccac147..c2f27c9 100644
--- a/index.js
+++ b/index.js
@@ -24,5 +24,6 @@ module.exports = function (stream) {
if (reads === 0) waiting = true;
};
stream.once('end', function () { ro.push(null) });
+ stream.on('error', function (err) { ro.emit('error', err) });
return ro;
};
diff --git a/test/error.js b/test/error.js
new file mode 100644
index 0000000..e53447c
--- /dev/null
+++ b/test/error.js
@@ -0,0 +1,15 @@
+var test = require('tape');
+var readonly = require('../');
+var through = require('through2');
+
+test('error', function (t) {
+ t.plan(1);
+
+ var stream = through();
+ var ro = readonly(stream);
+
+ ro.on('error', function (err) {
+ t.ok(err);
+ });
+ stream.emit('error', new Error);
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-read-only-stream.git
More information about the Pkg-javascript-commits
mailing list