Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

from2-error

decompil3d18MIT1.0.2

Create a stream that immediately emits the specified Error. Sugary wrapper around from2.

from2, stream, error, from, stream2, streams2

readme

CI Coverage Status

NPM

from2-error

Create a stream that immediately emits the specified Error. Sugary wrapper around from2.

Useful when you want to create a Stream for unit testing your error handlers.

Example

const from = require('from-error');
const through = require('through2');

from(new Error('Test error'))
  .on('error', err => {
    // Handle the error here
  })
  .on('data', () => {
    // This will never run
  })
  .on('end', () => {
    // This will never run
  })
  .on('close', () => {
    // This will emit when the stream is done
  });

Testing

npm test

License

MIT

changelog

from2-error

1.0.2

  • Update dependencies

1.0.1

  • Update dependencies

1.0.0

  • Stable

0.1.0

  • Initial release