From 488d5dd6a738eb99432d9354df2e8c15606edd41 Mon Sep 17 00:00:00 2001 From: Richard Alvarez Date: Tue, 29 Sep 2015 14:20:57 -0400 Subject: [PATCH] Emit error on correct stream This change fixes one of the issues from #98. `state.stream` can be the wrong stream to emit an error to if no path is passed however `ret` will always be the right stream to emit to. This makes it possible to listen for 'error' events although an error is still squelched if it's not listened for. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b3703f9..0e09bcc 100644 --- a/index.js +++ b/index.js @@ -232,7 +232,7 @@ function Xray() { } node(function(err) { - if (err) state.stream.emit('error', err); + if (err) ret.emit('error', err); }) return ret;