index.js 216 Bytes
var Stream = require('stream');

module.exports = function (stream, error) {
  if (stream instanceof Stream
    && !~stream.listeners('error').indexOf(error)) {
    stream.on('error', error);
  }
  return stream;
};