Skip to content

Docs: add exception handling examples in stream #4491

Closed
@stevemao

Description

@stevemao

It is tempting to do something like this:

var error = new Error('some error');

stream
  .pipe(through(function(chunk) {
    throw error ;
  }))
  .on('error', function(err) {
    assert.equal(error, err);
  });

For me because in promise throwing an exception equals rejection.

The docs should tell what really happens when exceptions are thrown in these kind of functions (_read, _write, _writev, _transform, _flush).

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions