aboutsummaryrefslogtreecommitdiff
path: root/node_modules/error-inject/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/error-inject/index.js')
-rw-r--r--node_modules/error-inject/index.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/node_modules/error-inject/index.js b/node_modules/error-inject/index.js
new file mode 100644
index 00000000..2a479ea8
--- /dev/null
+++ b/node_modules/error-inject/index.js
@@ -0,0 +1,9 @@
+var Stream = require('stream');
+
+module.exports = function (stream, error) {
+ if (stream instanceof Stream
+ && !~stream.listeners('error').indexOf(error)) {
+ stream.on('error', error);
+ }
+ return stream;
+};