question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass stream as parameter to onFinish handler

See original GitHub issue

I have a Node stream that can emit an error and can also emit content afterwards.

Example:

import {
  PassThrough
} from 'stream';

const passthrough = new stream.PassThrough();
passthrough.pipe(process.stdout);

passthrough.emit(new Error('boom'));

passthrough.write('foo');  // This gets written to process.stdout, even though an error was emitted.

I’d like to handle the error and continue. I can do so if we update pipeReadable to call onFinish with stream as a third parameter.

This way I can override error handling to write a new StreamError without ending.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
vqvucommented, Sep 7, 2016

3.0.0-beta.3 released.

0reactions
vqvucommented, Sep 6, 2016

Yes. I will do that when I merge the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement finish event handler of custom writable stream class
The finish event and its signature is documented here. It does not have any parameters, it's merely a notification that the writable stream...
Read more >
Stream | Node.js v19.3.0 Documentation
The listener callback is passed a single Error argument when called. The stream is closed when the 'error' event is emitted unless the...
Read more >
How To Work with Files Using Streams in Node.js - DigitalOcean
Streams are an efficient way to handle files in Node.js. ... an array that contains the command-line arguments passed to a Node.js script....
Read more >
How to use Bloc with streams and concurrency
Bloc 7.2.0 and 8.0.0 introduce a new way to register event handlers. This article provides examples showing the old bloc syntax and how...
Read more >
Understanding Streams in Node.js - NodeSource
The parameter options is optional and can, among other things, be used to specify a text encoding. const { Readable } = require('stream');...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found