index.js
function createErrorHandler(opts, transform) {
  return err => {
    if ('emit' === opts.error) {
      transform.emit('error', err)
    }
    else if ('function' === typeof opts.error) {
      opts.error(err)
    }
    else {
      const message = colors.red(err.name) + '\n' + err.toString()
        .replace(/(ParseError.*)/, colors.red('$1'))
      log(message)
    }

    transform.emit('end')

    if (opts.callback) {
      opts.callback(through2())
    }
  }
}
function createErrorHandler(opts, transform) {
  return err => {
    if ('emit' === opts.error) {
      transform.emit('error', err)
    }
    else if ('function' === typeof opts.error) {
      opts.error(err)
    }
    else {
      const message = colors.red(err.name) + '\n' + err.toString()
        .replace(/(ParseError.*)/, colors.red('$1'))
      log(message)
    }

    transform.emit('end')

    if (opts.callback) {
      opts.callback(through2())
    }
  }
}
function createErrorHandler ( opts , transform ) { return err => { if ( 'emit' === opts . error ) { transform . emit ( 'error' , err ) } else if ( 'function' === typeof opts . error ) { opts . error ( err ) } else { const message = colors . red ( err . name ) + '\n' + err . toString ( ) . replace ( / (ParseError.*) / , colors . red ( '$1' ) ) log ( message ) } transform . emit ( 'end' ) if ( opts . callback ) { opts . callback ( through2 ( ) ) } } }
Return a new error handler.

@param  {object} opts
@param  {stream.Transform} transform
@return {function}
Return a new error handler .