Permalink
Browse files

implement error proxying

  • Loading branch information...
1 parent 2c7269c commit d9d38c8d842c419fbd415e88c37114e8cd8076ed @Raynos committed Aug 14, 2012
Showing with 9 additions and 1 deletion.
  1. +7 −0 index.js
  2. +2 −1 test.js
View
@@ -27,6 +27,9 @@ function duplex(writer, reader) {
reader.on("end", handleEnd)
+ writer.on("error", reemit)
+ reader.on("error", reemit)
+
return stream
function getWritable() {
@@ -77,4 +80,8 @@ function duplex(writer, reader) {
args.unshift("end")
stream.emit.apply(stream, args)
}
+
+ function reemit(err) {
+ stream.emit("error", err)
+ }
}
View
@@ -23,4 +23,5 @@ stream.write()
readable.emit("data")
assert.equal(written, 1)
-assert.equal(data, 1)
+assert.equal(data, 1)
+console.log("DONE")

0 comments on commit d9d38c8

Please sign in to comment.